org.stanwood.media.search
Class AbstractMediaSearcher

java.lang.Object
  extended by org.stanwood.media.search.AbstractMediaSearcher
All Implemented Interfaces:
IMediaSearcher
Direct Known Subclasses:
FilmSearcher, ShowSearcher

public abstract class AbstractMediaSearcher
extends java.lang.Object
implements IMediaSearcher

This class is used to search for the a media files name


Constructor Summary
AbstractMediaSearcher(java.util.List<ISearchStrategy> strategies)
          Used to create a instance of this class
 
Method Summary
protected abstract  SearchResult doSearch(java.io.File mediaFile, java.lang.String term, java.lang.String year, java.lang.Integer part, boolean useSources)
          Used todo a search on the term and the year and return the result
 SearchResult search(java.io.File mediaFile, MediaDirectory mediaDir, boolean useSources)
          Used to search for a media id
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMediaSearcher

public AbstractMediaSearcher(java.util.List<ISearchStrategy> strategies)
Used to create a instance of this class

Parameters:
strategies - The search strategies that should be used
Method Detail

doSearch

protected abstract SearchResult doSearch(java.io.File mediaFile,
                                         java.lang.String term,
                                         java.lang.String year,
                                         java.lang.Integer part,
                                         boolean useSources)
                                  throws java.net.MalformedURLException,
                                         java.io.IOException,
                                         SourceException,
                                         StoreException
Used todo a search on the term and the year and return the result

Parameters:
term - The term to search for (Usually a film name or tv show name).
year - The year of the media or null if not to be used in the search
mediaFile - The media file we are searching for
useSources - True to search sources, otherwise will only use stores
Returns:
The search result or null if nothing could be found
Throws:
java.net.MalformedURLException - Thrown if their is a URL construction problem
java.io.IOException - Thrown if their is a IO problem
SourceException - Thrown if their is a problem searching via a source
StoreException

search

public final SearchResult search(java.io.File mediaFile,
                                 MediaDirectory mediaDir,
                                 boolean useSources)
                          throws java.net.MalformedURLException,
                                 java.io.IOException,
                                 SourceException,
                                 StoreException
Used to search for a media id

Specified by:
search in interface IMediaSearcher
Parameters:
mediaFile - The episode file been processed
mediaDir - The root media directory
useSources - True to search sources, otherwise will only use stores
Returns:
The results of the search, or null if nothing could be found
Throws:
java.net.MalformedURLException - Thrown if their is a problem construction URL's
java.io.IOException - Thrown if their is a IO problem
SourceException - Thrown if their are any source problems
StoreException - Thrown if their is a problem related to stores