public class MediaDirectory
extends java.lang.Object
Constructor and Description |
---|
MediaDirectory(Controller controller,
ConfigReader config,
java.io.File mediaDir)
The constructor
|
Modifier and Type | Method and Description |
---|---|
void |
aboutToRenamedFile(java.io.File rootMediaDir,
java.io.File oldFile,
java.io.File newFile)
This is used when a file that holds a episode or film is about to be renamed
|
protected void |
createSearchers() |
void |
fileChanged(java.io.File file)
This is called to notify stores that a file has changed.
|
java.util.List<IAction> |
getActions()
Get the actions been used by the media directory
|
Controller |
getController()
Used to get the media controller
|
IEpisode |
getEpisode(java.io.File rootMediaDir,
java.io.File episodeFile,
ISeason season,
java.util.List<java.lang.Integer> episodeNums,
boolean refresh,
boolean storeIfNew)
Get a episode with a given episode number.
|
IFilm |
getFilm(java.io.File rootMediaDir,
java.io.File filmFile,
SearchResult searchResult,
boolean refresh,
boolean cacheIfNew)
Get a film with a given film id and source id.
|
MediaDirConfig |
getMediaDirConfig()
Get the configuration of the media directory
|
java.io.File |
getPath(java.lang.String name)
Used to get the full location of a file within the media directory
|
ISeason |
getSeason(java.io.File rootMediaDir,
java.io.File episodeFile,
IShow show,
int seasonNum,
boolean refresh)
Get a season with a given season number.
|
IShow |
getShow(java.io.File rootMediaDir,
java.io.File episodeFile,
SearchResult searchResult,
boolean refresh)
Get a show with a given show id and source id.
|
java.util.List<ISource> |
getSources()
Get the sources been used by the media directory
|
IEpisode |
getSpecial(java.io.File rootMediaDir,
java.io.File specialFile,
ISeason season,
java.util.List<java.lang.Integer> specialNums,
boolean refresh)
Get a special episode with a given special episode number.
|
java.util.List<IStore> |
getStores()
Get the stores been used by the media directory
|
void |
renamedFile(java.io.File rootMediaDir,
java.io.File oldFile,
java.io.File newFile)
This is used when a file that holds a episode or film has been renamed
|
SearchResult |
searchForVideoId(java.io.File mediaFile,
boolean useSources)
This will search for a show id in the stores and sources.
|
public MediaDirectory(Controller controller, ConfigReader config, java.io.File mediaDir) throws ConfigException
controller
- The media controllerconfig
- The configuration of the media directorymediaDir
- The location of the media directoryConfigException
- Thrown if their is a problem reading the configurationprotected void createSearchers()
public IShow getShow(java.io.File rootMediaDir, java.io.File episodeFile, SearchResult searchResult, boolean refresh) throws java.net.MalformedURLException, SourceException, java.io.IOException, StoreException
rootMediaDir
- The root media directoryepisodeFile
- The file the episode is stored insearchResult
- The search results from looking for a showrefresh
- If true, then the stores are ignored.java.net.MalformedURLException
- Thrown if their is a problem creating URL'sSourceException
- Thrown if their is a source related problem.java.io.IOException
- Thrown if their is a I/O related problem.StoreException
- Thrown if their is a store related problem.public IFilm getFilm(java.io.File rootMediaDir, java.io.File filmFile, SearchResult searchResult, boolean refresh, boolean cacheIfNew) throws java.net.MalformedURLException, SourceException, java.io.IOException, StoreException
rootMediaDir
- The root media directoryfilmFile
- The file the film is stored insearchResult
- The resulting film from a searchrefresh
- If true, then the stores are ignored.cacheIfNew
- True to cache information in stores if it was new to the storejava.net.MalformedURLException
- Thrown if their is a problem creating URL'sSourceException
- Thrown if their is a source related problem.java.io.IOException
- Thrown if their is a I/O related problem.StoreException
- Thrown if their is a store related problem.public ISeason getSeason(java.io.File rootMediaDir, java.io.File episodeFile, IShow show, int seasonNum, boolean refresh) throws SourceException, java.io.IOException, StoreException
rootMediaDir
- The root media directoryepisodeFile
- The file the episode is stored inshow
- The show the season belongs tooseasonNum
- The season numberrefresh
- If true, then the stores are ignored.SourceException
- Thrown if their is a source related problem.java.io.IOException
- Thrown if their is a I/O related problem.StoreException
- Thrown if their is a store related problem.public IEpisode getEpisode(java.io.File rootMediaDir, java.io.File episodeFile, ISeason season, java.util.List<java.lang.Integer> episodeNums, boolean refresh, boolean storeIfNew) throws SourceException, java.net.MalformedURLException, java.io.IOException, StoreException
rootMediaDir
- The root media directoryseason
- The season the episode belongs tooepisodeNums
- The episode numbersrefresh
- If true, then the stores are ignored.episodeFile
- The file the episode is stored instoreIfNew
- True to cache information in stores if it was new to the storejava.net.MalformedURLException
- Thrown if their is a problem creating URL'sSourceException
- Thrown if their is a source related problem.java.io.IOException
- Thrown if their is a I/O related problem.StoreException
- Thrown if their is a store related problem.public IEpisode getSpecial(java.io.File rootMediaDir, java.io.File specialFile, ISeason season, java.util.List<java.lang.Integer> specialNums, boolean refresh) throws SourceException, java.net.MalformedURLException, java.io.IOException, StoreException
rootMediaDir
- The root media directoryseason
- The season the episode belongs toospecialNums
- The special episode numbersrefresh
- If true, then the stores are ignored.specialFile
- The file the special episode is stored injava.net.MalformedURLException
- Thrown if their is a problem creating URL'sSourceException
- Thrown if their is a source related problem.java.io.IOException
- Thrown if their is a I/O related problem.StoreException
- Thrown if their is a store related problem.public void fileChanged(java.io.File file) throws StoreException
file
- The file that has changedStoreException
- Thrown if their are any problemspublic SearchResult searchForVideoId(java.io.File mediaFile, boolean useSources) throws SourceException, StoreException, java.net.MalformedURLException, java.io.IOException
mediaFile
- The file the media is stored inuseSources
- True to search sources, otherwise will only use storesSourceException
- Thrown if their is a problem reading from a sourceStoreException
- Thrown if their is a problem reading for a storejava.io.IOException
- Throw if their is a IO problemjava.net.MalformedURLException
- Throw if their is a problem creating a URLpublic void renamedFile(java.io.File rootMediaDir, java.io.File oldFile, java.io.File newFile) throws StoreException
rootMediaDir
- The root media directoryoldFile
- The old filenewFile
- The new fileStoreException
- Thrown if their is a problem renaming filespublic void aboutToRenamedFile(java.io.File rootMediaDir, java.io.File oldFile, java.io.File newFile)
rootMediaDir
- The root media directoryoldFile
- The old filenewFile
- The new filepublic MediaDirConfig getMediaDirConfig()
public java.util.List<IStore> getStores()
public java.util.List<ISource> getSources()
public java.util.List<IAction> getActions()
public java.io.File getPath(java.lang.String name)
name
- the path of the file relative to the media directorypublic Controller getController()