org.stanwood.media.source
Class HybridFilmSource

java.lang.Object
  extended by org.stanwood.media.source.HybridFilmSource
All Implemented Interfaces:
IExtension, ISource

public class HybridFilmSource
extends java.lang.Object
implements ISource

This class is a source used to retrieve the best film information it can. It does this by calling other sources and picking the best information from them.

This source supports the following parameters:


Field Summary
static java.lang.String OLD_SOURCE_ID
          The ID of the the source
 
Constructor Summary
HybridFilmSource(HybridFilmSourceInfo sourceInfo)
          Used to create a instance of the source
 
Method Summary
 IEpisode getEpisode(ISeason season, int episodeNum, java.io.File file)
          This always returns null as this source does not support reading episodes.
 IFilm getFilm(java.lang.String filmId, java.net.URL url, java.io.File file)
          This will get a film from the source.
 ExtensionInfo<? extends ISource> getInfo()
          Used to get the source information details
 java.lang.String getParameter(java.lang.String key)
          Used to get the value of a source parameter.
 ISeason getSeason(IShow show, int seasonNum)
          This always returns null as this source does not support reading episodes.
 Show getShow(java.lang.String showId, java.net.URL url, java.io.File file)
          This always returns null as this source does not support reading episodes.
 IEpisode getSpecial(ISeason season, int specialNumber, java.io.File file)
          This always returns null as this source does not support reading episodes.
 SearchResult searchMedia(java.lang.String name, java.lang.String year, Mode mode, java.lang.Integer part)
          This is called to search the source for media details
 void setMediaDirConfig(MediaDirectory dir)
          Called to tell the source which media directory is been processed
 void setParameter(java.lang.String key, java.lang.String value)
          Used to set source parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OLD_SOURCE_ID

public static final java.lang.String OLD_SOURCE_ID
The ID of the the source

See Also:
Constant Field Values
Constructor Detail

HybridFilmSource

public HybridFilmSource(HybridFilmSourceInfo sourceInfo)
                 throws SourceException
Used to create a instance of the source

Parameters:
sourceInfo - The description of the the source
Throws:
SourceException - Thrown if their are any problems
Method Detail

setMediaDirConfig

public void setMediaDirConfig(MediaDirectory dir)
                       throws SourceException
Called to tell the source which media directory is been processed

Specified by:
setMediaDirConfig in interface ISource
Parameters:
dir - The media directory
Throws:
SourceException - Thrown if their is a problem with the source

getEpisode

public IEpisode getEpisode(ISeason season,
                           int episodeNum,
                           java.io.File file)
This always returns null as this source does not support reading episodes.

Specified by:
getEpisode in interface ISource
Parameters:
season - The season the episode belongs to.
episodeNum - The number of the episode to read
file - The film file if looking up a files details, or NULL
Returns:
The episode

getSeason

public ISeason getSeason(IShow show,
                         int seasonNum)
This always returns null as this source does not support reading episodes.

Specified by:
getSeason in interface ISource
Parameters:
show - The show the season belongs to.
seasonNum - The number of the season to read
Returns:
The season if it can be found, otherwise null.

getShow

public Show getShow(java.lang.String showId,
                    java.net.URL url,
                    java.io.File file)
This always returns null as this source does not support reading episodes.

Specified by:
getShow in interface ISource
Parameters:
file - The media file if looking up a files details, or NULL
url - String url of the show
showId - The id of the show to read
Returns:
The show if it can be found, otherwise null.

getSpecial

public IEpisode getSpecial(ISeason season,
                           int specialNumber,
                           java.io.File file)
This always returns null as this source does not support reading episodes.

Specified by:
getSpecial in interface ISource
Parameters:
season - The season the episode belongs to.
specialNumber - The number of the special episode to read
file - The film file if looking up a files details, or NULL
Returns:
The special episode, or null if it can't be found

getFilm

public IFilm getFilm(java.lang.String filmId,
                     java.net.URL url,
                     java.io.File file)
              throws SourceException,
                     java.net.MalformedURLException,
                     java.io.IOException
This will get a film from the source. If the film can't be found, then it will return null.

Specified by:
getFilm in interface ISource
Parameters:
filmId - The id of the film
url - The URL to use when looking up film details
file - The film file if looking up a files details, or NULL
Returns:
The film, or null if it can't be found
Throws:
SourceException - Thrown if their is a problem retrieving the data
java.net.MalformedURLException - Thrown if their is a problem creating URL's
java.io.IOException - Thrown if their is a I/O related problem.

searchMedia

public SearchResult searchMedia(java.lang.String name,
                                java.lang.String year,
                                Mode mode,
                                java.lang.Integer part)
                         throws SourceException
This is called to search the source for media details

Specified by:
searchMedia in interface ISource
Parameters:
name - The search term
year - The year to search for or empty string if not needed
mode - The mode of the search
part - The part number to search for
Returns:
The search result or NULL if it could not be found
Throws:
SourceException - Thrown if their is a problem with the source

setParameter

public void setParameter(java.lang.String key,
                         java.lang.String value)
                  throws SourceException

Used to set source parameters. If the key is not supported by this source, then a SourceException is thrown.

This source supports the following parameters:

Specified by:
setParameter in interface ISource
Parameters:
key - The key of the parameter
value - The value of the parameter
Throws:
SourceException - Throw if the key is not supported by this source.

getParameter

public java.lang.String getParameter(java.lang.String key)
                              throws SourceException

Used to get the value of a source parameter. If the key is not supported by this source, then a SourceException is thrown.

This source supports the following parameters:

Specified by:
getParameter in interface ISource
Parameters:
key - The key of the parameter
Returns:
The value of the parameter
Throws:
SourceException - Throw if the key is not supported by this source.

getInfo

public ExtensionInfo<? extends ISource> getInfo()
Used to get the source information details

Specified by:
getInfo in interface ISource
Returns:
the source information details