com.blackledge.david.tivo.multitasker.plugins
Class GenericAudio

java.lang.Object
  extended by com.blackledge.david.tivo.multitasker.plugins.GenericAudio
All Implemented Interfaces:
Audio, LocalOptionProvider

public class GenericAudio
extends Object
implements Audio, LocalOptionProvider

Provide Audio via URLs listed in OPTION_URLS ("GenericAudio.urls"). Supports shuffle - if it randomly choose a URL ( MultiTaskerApplication.OPTION_AUDIO_RANDOM ) and it is a multi-source like an rss feed, it selects the first one, then puts the rest in a pool of random selections every time that url is randomly chosen again until it needs to re-feed the pool for that URL. (the pool is shared by all URLs, however, so it doesn't work exactly as one might expect, but it should be indistinguishable from normal shuffling)

Version:
$Revision: 1.1 $

Field Summary
static String OPTION_FIRST_ONLY_WHEN_MULTIPLE
           
static String OPTION_PREVENT_DUPLICATES
           
static String OPTION_URLS
           
 
Fields inherited from interface com.blackledge.david.tivo.multitasker.LocalOptionProvider
TYPE_BOOLEAN, TYPE_CLASS, TYPE_COLOR, TYPE_FILE, TYPE_FLOAT, TYPE_FOLDER, TYPE_IMAGE, TYPE_INTEGER, TYPE_STRING, TYPE_URL
 
Constructor Summary
GenericAudio()
           
 
Method Summary
 String getLocalOptionDefault(String key)
          no default for URL, just Prevent Duplicates (true).
 Collection getLocalOptionNames()
          just the keySet of getLocalOptionPreferences()
 Map getLocalOptionPreferences()
          Add support for OPTION_URLS and OPTION_PREVENT_DUPLICATES map of your option keys where the value is "Type[+],text [range]" per the MultiTaskerPreferences class.
 String getNextAudioStream()
          Provides the next Audio Stream to play.
 void init(MultiTaskerApplication app)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTION_URLS

public static final String OPTION_URLS
See Also:
Constant Field Values

OPTION_PREVENT_DUPLICATES

public static final String OPTION_PREVENT_DUPLICATES
See Also:
Constant Field Values

OPTION_FIRST_ONLY_WHEN_MULTIPLE

public static final String OPTION_FIRST_ONLY_WHEN_MULTIPLE
See Also:
Constant Field Values
Constructor Detail

GenericAudio

public GenericAudio()
Method Detail

init

public void init(MultiTaskerApplication app)
Specified by:
init in interface Audio

getNextAudioStream

public String getNextAudioStream()
Description copied from interface: Audio
Provides the next Audio Stream to play. Use a URL of the form app.getContext().getBaseURI().toString()+"local/"+myFilePath To play a file local to the current computer, where myFilePath is relative to the local file root defined in options.

Specified by:
getNextAudioStream in interface Audio
Returns:
a URL string that will provide an mp3 stream.

getLocalOptionNames

public Collection getLocalOptionNames()
just the keySet of getLocalOptionPreferences()

Specified by:
getLocalOptionNames in interface LocalOptionProvider
Returns:

getLocalOptionPreferences

public Map getLocalOptionPreferences()
Add support for OPTION_URLS and OPTION_PREVENT_DUPLICATES map of your option keys where the value is "Type[+],text [range]" per the MultiTaskerPreferences class. Use a LinkedHashMap to maintain the order of your options.

Specified by:
getLocalOptionPreferences in interface LocalOptionProvider
Returns:
See Also:
LocalOptionProvider.getLocalOptionPreferences()

getLocalOptionDefault

public String getLocalOptionDefault(String key)
no default for URL, just Prevent Duplicates (true). defaults for each of the local option keys. Could just return null if there is no provided default. If the local option default starts with a +, it is appended (delimeted by a comma) to the getOptionDefault value, if any.

Specified by:
getLocalOptionDefault in interface LocalOptionProvider
Returns:
Option value to use if none is set or overridden.
See Also:
LocalOptionProvider.getLocalOptionDefault(java.lang.String)