Package de.sfuhrm.radiorecorder
Class ConsumerContext
- java.lang.Object
-
- de.sfuhrm.radiorecorder.ConsumerContext
-
public class ConsumerContext extends Object
Immutable context common to all consumers. Holds the data necessary to record or play one stream from one radio station.- Author:
- Stephan Fuhrmann
-
-
Constructor Summary
Constructors Constructor Description ConsumerContext(int id, Radio radio, Params params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<Long>getAbortAfter()Get the amount of bytes after which to abort.StringgetCastReceiver()The cast device to cast to.HttpConnectionBuilderFactory.HttpClientTypegetHttpClient()The client type to use.longgetMinFree()Get minimum free bytes.Mixer.InfogetMixerInfo()The mixer to play on.URLgetProxy()The HTTP proxy to use or NULL.FilegetTargetDirectory()Get the directory to write files to.intgetTimeout()Get the read/connect timeout in millis.booleanisPlaying()Whether to play or store.booleanisReconnect()Reconnect forever.booleanisSongNames()Whether to name the files after the metadata retrieved.
-
-
-
Constructor Detail
-
ConsumerContext
public ConsumerContext(int id, Radio radio, Params params) throws MalformedURLException- Throws:
MalformedURLException
-
-
Method Detail
-
getTimeout
public int getTimeout()
Get the read/connect timeout in millis.- Returns:
- the timeout in milliseconds.
-
getTargetDirectory
public File getTargetDirectory()
Get the directory to write files to.- Returns:
- directory to write files to.
-
getMinFree
public long getMinFree()
Get minimum free bytes.- Returns:
- minimum number of free bytes on disk.
-
getAbortAfter
public Optional<Long> getAbortAfter()
Get the amount of bytes after which to abort.- Returns:
- optional maximum of bytes after which to abort writing to write to disk.
-
isPlaying
public boolean isPlaying()
Whether to play or store.- Returns:
trueif playing was requested on the command line,falseotherwise.
-
isSongNames
public boolean isSongNames()
Whether to name the files after the metadata retrieved.- Returns:
trueif meta data naming was requested on the command line,falseotherwise.
-
isReconnect
public boolean isReconnect()
Reconnect forever.- Returns:
trueif reconnecting was requested on the command line,falseotherwise.
-
getCastReceiver
public String getCastReceiver()
The cast device to cast to.- Returns:
- the name of the chrome cast receiver to play on.
-
getMixerInfo
public Mixer.Info getMixerInfo()
The mixer to play on.- Returns:
- the mixer info to play on, or
nullif the default is ok.
-
getHttpClient
public HttpConnectionBuilderFactory.HttpClientType getHttpClient()
The client type to use.- Returns:
- the HTTP client type requested in the command line.
-
getProxy
public URL getProxy()
The HTTP proxy to use or NULL.- Returns:
- the HTTP proxy requested in the command line.
-
-