org.stanwood.media.source.xbmc
Class XBMCSource

java.lang.Object
  extended by org.stanwood.media.xml.XMLParser
      extended by org.stanwood.media.source.xbmc.XBMCSource
All Implemented Interfaces:
IExtension, ISource

public class XBMCSource
extends XMLParser
implements ISource

This is a source that reads the details using XBMC addons. It is capable of reading both TV Show and Film information if the XBMC Scraper supports it. Any parameters set on this source are passed through to the XBMC scrapers.


Field Summary
 
Fields inherited from class org.stanwood.media.xml.XMLParser
DTD_WEB_LOCATION, SCHEMA_WEB_LOCATION
 
Constructor Summary
XBMCSource(ExtensionInfo<? extends ISource> sourceInfo, XBMCAddonManager mgr, java.lang.String addonId)
          Used to create a instance of this class
 
Method Summary
 IEpisode getEpisode(ISeason season, int episodeNum, java.io.File file)
          Called to retrieve the information on a episode
 Film 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 will get a season from the source.
 Show getShow(java.lang.String showId, java.net.URL url, java.io.File file)
          This will get a show from the source.
 IEpisode getSpecial(ISeason season, int specialNumber, java.io.File file)
          This gets a special episode from the source.
protected  void parseCertification(IVideoCertification video, org.w3c.dom.Document doc)
           
 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.
 java.lang.String toString()
          
 
Methods inherited from class org.stanwood.media.xml.XMLParser
createDocBuilder, createFactory, deleteNode, domToStr, encodeAttributeValue, firstChild, getAttribute, getElement, getFirstChildElement, getFloatFromXML, getIntegerFromXML, getLastChildElement, getLongFromXML, getSchema, getStringFromXML, getStringFromXMLOrNull, getURLFromXML, getURLFromXMLOrNull, hasNode, parse, parse, parse, quoteXPathQuery, selectChildNodes, selectNodeList, selectSingleNode, strToDom, strToDom, strToDom, writeXML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XBMCSource

public XBMCSource(ExtensionInfo<? extends ISource> sourceInfo,
                  XBMCAddonManager mgr,
                  java.lang.String addonId)
           throws XBMCException
Used to create a instance of this class

Parameters:
sourceInfo - The source information
mgr - The addon manager
addonId - The ID of the sources XBMC addon
Throws:
XBMCException - Thrown if their are any problems
Method Detail

getEpisode

public IEpisode getEpisode(ISeason season,
                           int episodeNum,
                           java.io.File file)
                    throws SourceException,
                           java.net.MalformedURLException,
                           java.io.IOException
Called to retrieve the information on a episode

Specified by:
getEpisode in interface ISource
Parameters:
season - The season the episode belongs too
episodeNum - The number of the episode
file - The film file if looking up a files details, or NULL
Returns:
The episode
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 - Throw if their is a IO related problem

getSeason

public ISeason getSeason(IShow show,
                         int seasonNum)
                  throws SourceException,
                         java.io.IOException
This will get a season from the source. If the season can't be found, then it will return null.

Specified by:
getSeason in interface ISource
Parameters:
show - The show the season belongs too
seasonNum - The number of the season that is to be fetched
Returns:
The season if it can be found, otherwise null.
Throws:
SourceException - Thrown if their is a problem retrieving the data
java.io.IOException - Thrown if their is a I/O related problem.

getShow

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

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

getFilm

public Film 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 used to lookup the film
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.

parseCertification

protected void parseCertification(IVideoCertification video,
                                  org.w3c.dom.Document doc)
                           throws XMLParserException
Throws:
XMLParserException

getSpecial

public IEpisode getSpecial(ISeason season,
                           int specialNumber,
                           java.io.File file)
                    throws SourceException,
                           java.net.MalformedURLException,
                           java.io.IOException
This gets a special episode from the source. If it can't be found, then it will return null;

Specified by:
getSpecial in interface ISource
Parameters:
season - The season the special episode belongs too
specialNumber - The number of the special episode too get
file - The film file if looking up a files details, or NULL
Returns:
The special episode, 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.

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.

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.

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

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

getInfo

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

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