public class MP4ITunesStore extends java.lang.Object implements IStore
This store is used to store Film/TV show information in .mp4/.m4v files used by iTunes. This allows iTunes to use the meta data and see the files complete with their meta data.
In order to function, this store uses the command line tools provided by the AtomicParsley application. Their are different forks of this application on the Internet. The most feature rich version I've found is at "https://bitbucket.org/shield007/atomicparsley". Media manager uses this one to add atoms that some of the other versions can't. The application must be installed on the PATH, or pointed to by the optional store parameters.
If using a version of AtomicParsley that does not support the setting of all fields that this store can handle, then a warning will be printed. A version with the above link that fully supports this store can downloaded from the MediaManager web site or installed via the installer.
This store has following optional parameters:
Modifier and Type | Field and Description |
---|---|
static StoreVersion |
STORE_VERSION |
Constructor and Description |
---|
MP4ITunesStore(Controller controller,
MP4ITunesStoreInfo storeInfo)
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
|
void |
cacheEpisode(java.io.File rootMediaDir,
java.io.File episodeFile,
java.io.File oldFileName,
IEpisode episode)
This is used to store episode information of a TVShow MP4 file into the
file as meta data so that iTunes can read it.
|
void |
cacheFilm(java.io.File rootMediaDir,
java.io.File filmFile,
java.io.File oldFileName,
IFilm film,
java.lang.Integer part)
This is used to write a film to the store.
|
void |
cacheSeason(java.io.File rootMediaDir,
java.io.File episodeFile,
ISeason season)
This does nothing as the season information can't be stored by this store
|
void |
cacheShow(java.io.File rootMediaDir,
java.io.File episodeFile,
IShow show)
This does nothing as the show information can't be stored by this store
|
void |
fileDeleted(MediaDirectory dir,
java.io.File file)
This is called when a file is deleted from a media directory
|
boolean |
fileKnownByStore(MediaDirectory mediaDirectory,
java.io.File file)
Used to check that a media file is known by a store
|
void |
fileUpdated(MediaDirectory mediaDirectory,
java.io.File file)
This is called when a file is updated within a media directory.
|
IEpisode |
getEpisode(java.io.File rootMediaDir,
java.io.File episodeFile,
ISeason season,
java.util.List<java.lang.Integer> episodeNums)
This will always return null as this is a write only store
|
IEpisode |
getEpisode(MediaDirectory dir,
java.io.File file)
This is used to get a episode from a store via it's file name.
|
IFilm |
getFilm(java.io.File rootMediaDir,
java.io.File filmFile,
java.lang.String filmId)
Always returns null as it is not implemented for this store.
|
IFilm |
getFilm(MediaDirectory dir,
java.io.File file)
This is used to get a film from a store via it's file name.
|
java.lang.String |
getParameter(java.lang.String key)
Used to get the value of a source parameter.
|
ISeason |
getSeason(java.io.File rootMediaDir,
java.io.File episodeFile,
IShow show,
int seasonNum)
This will always return null as this is a write only store
|
IShow |
getShow(java.io.File rootMediaDir,
java.io.File episodeFile,
java.lang.String showId)
This will always return null as this is a write only store
|
IEpisode |
getSpecial(java.io.File rootMediaDir,
java.io.File episodeFile,
ISeason season,
java.util.List<java.lang.Integer> specialNumbers)
This will always return null as this is a write only store
|
void |
init()
Called to initialise the stores and check all their resources can be found.
|
protected boolean |
isItunesExtension(java.io.File file) |
java.util.List<IEpisode> |
listEpisodes(MediaDirConfig dirConfig,
IProgressMonitor monitor)
This is used to list all the episodes within the store if the store supports the operation.
|
java.util.List<IFilm> |
listFilms(MediaDirConfig dirConfig,
IProgressMonitor monitor)
This is used to list all the films within the store if the store supports the operation.
|
void |
performedActions(MediaDirectory dir)
This is called after all the actions on all the media files have been performed so that
the store can clean up any stale data.
|
protected java.util.Properties |
readStoreConfig(MediaDirectory mediaDirectory,
java.io.File configFile) |
void |
renamedFile(java.io.File rootMediaDir,
java.io.File oldFile,
java.io.File newFile)
This does nothing as the meta data is stored in the actual file
|
protected void |
saveStoreVersion(MediaDirectory mediaDirectory) |
SearchResult |
searchMedia(java.lang.String name,
Mode mode,
java.lang.Integer part,
MediaDirConfig dirConfig,
java.io.File mediaFile)
Used to search for store for media
|
void |
setParameter(java.lang.String key,
java.lang.String value)
Used to set source parameters.
|
void |
upgrade(MediaDirectory mediaDirectory)
This is called to check if a upgrade is needed and perform the upgrade if required
|
public static final StoreVersion STORE_VERSION
public MP4ITunesStore(Controller controller, MP4ITunesStoreInfo storeInfo)
controller
- The controllerstoreInfo
- The store informationpublic void init() throws StoreException
init
in interface IStore
StoreException
- Thrown if their are any problemspublic void cacheEpisode(java.io.File rootMediaDir, java.io.File episodeFile, java.io.File oldFileName, IEpisode episode) throws StoreException
cacheEpisode
in interface IStore
episodeFile
- The mp4 episode fileepisode
- The episode detailsrootMediaDir
- This is the directory which is the root of media, this can be the current directory if
it was not specified on the command line.oldFileName
- The name of the file before it was moved into the storeStoreException
- Thrown if their is a problem storing the meta datapublic void cacheSeason(java.io.File rootMediaDir, java.io.File episodeFile, ISeason season) throws StoreException
cacheSeason
in interface IStore
episodeFile
- The mp4 episode fileseason
- The season detailsrootMediaDir
- This is the directory which is the root of media, this can be the current directory if
it was not specified on the command line.StoreException
- Thrown if their is a problem storing the meta datapublic void cacheShow(java.io.File rootMediaDir, java.io.File episodeFile, IShow show) throws StoreException
cacheShow
in interface IStore
episodeFile
- The mp4 episode fileshow
- The show detailsrootMediaDir
- This is the directory which is the root of media, this can be the current directory if
it was not specified on the command line.StoreException
- Thrown if their is a problem storing the meta datapublic IEpisode getEpisode(java.io.File rootMediaDir, java.io.File episodeFile, ISeason season, java.util.List<java.lang.Integer> episodeNums) throws StoreException
getEpisode
in interface IStore
episodeFile
- the file which the episode is stored inseason
- The season the episode belongs tooepisodeNums
- The numbers of the episode too getrootMediaDir
- This is the directory which is the root of media, this can be the current directory if
it was not specified on the command line.StoreException
- Thrown if their is a problem storing the meta datapublic ISeason getSeason(java.io.File rootMediaDir, java.io.File episodeFile, IShow show, int seasonNum) throws StoreException
getSeason
in interface IStore
episodeFile
- the file which the episode is stored inshow
- The show the season belongs tooseasonNum
- The number of the season too getrootMediaDir
- This is the directory which is the root of media, this can be the current directory if
it was not specified on the command line.StoreException
- Thrown if their is a problem storing the meta datapublic IShow getShow(java.io.File rootMediaDir, java.io.File episodeFile, java.lang.String showId) throws StoreException
getShow
in interface IStore
episodeFile
- the file which the episode is stored inshowId
- The show Id of the show too getrootMediaDir
- This is the directory which is the root of media, this can be the current directory if
it was not specified on the command line.StoreException
- Thrown if their is a problem storing the meta datapublic void cacheFilm(java.io.File rootMediaDir, java.io.File filmFile, java.io.File oldFileName, IFilm film, java.lang.Integer part) throws StoreException
cacheFilm
in interface IStore
filmFile
- The file which the film is stored infilm
- The film to writerootMediaDir
- This is the directory which is the root of media, this can be the current directory if
it was not specified on the command line.oldFileName
- The name of the file before it was moved into the storepart
- The part number of the filmStoreException
- Thrown if their is a problem with the storepublic IEpisode getSpecial(java.io.File rootMediaDir, java.io.File episodeFile, ISeason season, java.util.List<java.lang.Integer> specialNumbers) throws java.net.MalformedURLException, java.io.IOException, StoreException
getSpecial
in interface IStore
episodeFile
- the file which the special episode is stored inseason
- The season the episode belongs toospecialNumbers
- The numbers of the special episode too getrootMediaDir
- This is the directory which is the root of media, this can be the current directory if
it was not specified on the command line.StoreException
- Thrown if their is a problem storing the meta datajava.net.MalformedURLException
- Thrown if their is a problem creating URL'sjava.io.IOException
- Thrown if their is a I/O related problem.public void renamedFile(java.io.File rootMediaDir, java.io.File oldFile, java.io.File newFile)
renamedFile
in interface IStore
oldFile
- The old filenewFile
- The new filerootMediaDir
- This is the directory which is the root of media, this can be the current directory if
it was not specified on the command line.public IFilm getFilm(java.io.File rootMediaDir, java.io.File filmFile, java.lang.String filmId) throws StoreException, java.net.MalformedURLException, java.io.IOException
getFilm
in interface IStore
filmFile
- The file the film is stored infilmId
- The id of the filmrootMediaDir
- This is the directory which is the root of media, this can be the current directory if
it was not specified on the command line.StoreException
- Thrown if their is a problem retrieving the datajava.net.MalformedURLException
- Thrown if their is a problem creating URL'sjava.io.IOException
- Thrown if their is a I/O related problem.public SearchResult searchMedia(java.lang.String name, Mode mode, java.lang.Integer part, MediaDirConfig dirConfig, java.io.File mediaFile) throws StoreException
searchMedia
in interface IStore
name
- The search termmode
- The mode of the searchpart
- The part number to search fordirConfig
- The Media directory configurationmediaFile
- The media file the search is associated withStoreException
- Thrown if their is a problem with the storepublic void setParameter(java.lang.String key, java.lang.String value) throws StoreException
Used to set source parameters. If the key is not supported by this source, then a SourceException
is thrown.
setParameter
in interface IStore
key
- The key of the parametervalue
- The value of the parameterStoreException
- Throw if the key is not supported by this store.public java.lang.String getParameter(java.lang.String key) throws StoreException
Used to get the value of a source parameter. If the key is not supported by this source, then a SourceException
is thrown.
getParameter
in interface IStore
key
- The key of the parameterStoreException
- Throw if the key is not supported by this store.public void performedActions(MediaDirectory dir)
performedActions
in interface IStore
dir
- The media directorypublic void fileDeleted(MediaDirectory dir, java.io.File file)
fileDeleted
in interface IStore
dir
- The media directoryfile
- The filepublic IEpisode getEpisode(MediaDirectory dir, java.io.File file) throws StoreException
getEpisode
in interface IStore
dir
- The media directoryfile
- The media fileStoreException
- Thrown if their are any problemspublic IFilm getFilm(MediaDirectory dir, java.io.File file) throws StoreException
getFilm
in interface IStore
dir
- The media directoryfile
- The media fileStoreException
- Thrown if their are any problemspublic java.util.List<IEpisode> listEpisodes(MediaDirConfig dirConfig, IProgressMonitor monitor)
listEpisodes
in interface IStore
dirConfig
- The media directory configurationmonitor
- The progress monitorpublic java.util.List<IFilm> listFilms(MediaDirConfig dirConfig, IProgressMonitor monitor)
protected boolean isItunesExtension(java.io.File file)
public void upgrade(MediaDirectory mediaDirectory) throws StoreException
upgrade
in interface IStore
mediaDirectory
- The media directory been upgradedStoreException
- Thrown if thier are any problemsprotected void saveStoreVersion(MediaDirectory mediaDirectory) throws StoreException
StoreException
protected java.util.Properties readStoreConfig(MediaDirectory mediaDirectory, java.io.File configFile) throws StoreException
StoreException
public void fileUpdated(MediaDirectory mediaDirectory, java.io.File file) throws StoreException
fileUpdated
in interface IStore
mediaDirectory
- The media directory the file belongs tofile
- The media fileStoreException
- Thrown if their are any problemspublic boolean fileKnownByStore(MediaDirectory mediaDirectory, java.io.File file) throws StoreException
fileKnownByStore
in interface IStore
mediaDirectory
- The media directoryfile
- The media file to checkStoreException
public void aboutToRenamedFile(java.io.File rootMediaDir, java.io.File oldFile, java.io.File newFile) throws StoreException
aboutToRenamedFile
in interface IStore
rootMediaDir
- This is the directory which is the root of media, this can be the current directory if
it was not specified on the command line.oldFile
- The old filenewFile
- The new fileStoreException
- Thrown if their is a problem renaming files