MovieLibrary
Class VideoLibrary

java.lang.Object
  extended by MovieLibrary.VideoLibrary

public class VideoLibrary
extends java.lang.Object

Video Library class.
This class creates a Video Library where everything related to the library of videos is done.
This class stores information about the videos and some preferences linked to videos.

Author:
Alex Della-Croce

Constructor Summary
VideoLibrary()
          Constructor for a video library.
Creates a new empty Video library.
VideoLibrary(VideoLibrary reqLibrary)
          Creates a new Video Library from another.
 
Method Summary
 boolean addNewPlaylist(java.lang.String playlistName)
          adds a new playlist to this library.
 boolean addNewVideo(VideoObject videoToAdd)
          adds a new video to the library, but checks if videos has not been added before first.
 boolean changeVideoInfo(VideoObject newVideo, int videoIndexToBeReplaced)
          changes the content of the video with the given ID in the library with the content of the given video.
 void deleteAllVideos()
          removes all the videos from the library.
 boolean deleteVideo(int deletionIndex)
          deletes the video with the given ID from the library only.
 int[] getColumnWidths()
          get the widths of the columns of the main table.
 java.lang.String getConfigsVersion()
          get the configs file version
 boolean getDatabaseSearch()
          Gets the database search mode.
 java.lang.String getDefaultMovieInfoDatabaseAddress()
          gets the default address of the movie info database.
 java.util.ArrayList<java.lang.String> getFiltersActors()
           
 java.util.ArrayList<java.lang.String> getFiltersDirectors()
           
 java.util.ArrayList<java.lang.String> getFiltersGenres()
           
 java.util.ArrayList<java.lang.String> getFiltersSeasonNos()
           
 java.util.ArrayList<java.lang.String> getFiltersSeriesNames()
           
 java.util.ArrayList<java.lang.String> getFiltersYears()
           
 boolean getHiddenVideo(int videoIndex)
          get if the video is hidden to be specific video is filtered out by the media library filters.
 java.lang.String getLang()
          get DVD default language
 java.lang.String getLibraryVersion()
          get the library file version
 java.lang.String getMediaFolder()
          get the media folder path.
 java.lang.String getMediaPlayerLocation()
          gets the path of the media player.
 java.lang.String getMencoderLocation()
          gets the location of mencoder .
 java.lang.String getMovieInfoDatabaseAddress()
          gets the address of the movie info database.
 int getNoOfVideos()
          gets the number of videos stored in this library.
 Playlist[] getPlaylists()
          returns the playlist stored in this library.
 int getShownVideoCount()
          gets the number of videos that have not been filtered out by the media library fileters.
 int getThreads()
          get the threads used for converting (cores of the processor).
 boolean getValidVideo(int videoIndex)
          get state of the video path of the selected video.
 VideoObject getVideo(int index)
          gets the video with the given video ID.
 java.util.ArrayList<java.lang.String> getVideosGenres()
           
 VideoObject[] getVideosList()
          gets the list of videos stored in the library (filtered out or not).
 void hideNotSelected(int videoType, java.lang.String clipType, java.lang.String genre, java.lang.String director, java.lang.String actor, java.lang.String year, java.lang.String seriesName, java.lang.String seasonNo, boolean recalcGenre, boolean recalcDirect, boolean recalcActors, boolean recalcYears)
           
 boolean importConfigXml(java.io.File confXML)
          Method to read the configuration file and import it into the library.
 boolean importLibraryFromXML(java.lang.String requiredConfigXML, java.lang.String requiredLibraryXML)
          Method to import information from XML library and configuration XML to this library.
Calls separate methods for each file to check if valid and import them if so.
 boolean importLibraryXml(java.io.File libXML)
          Method to read and import a library XML file to this library.
 boolean isImportModeInDepth()
          Gives the state of the import mode.
In depth import mode off means import will only look for exact math from database, in depth mode on means if no exact match found title will be parsed and detailed search on this parsed title will be done against the database.
 boolean isMediaFolderOrganized()
          Returns the organize state of the media folder.
Organized means auto renaming and organising of videos inside the media folder.
 void reorderLibrary()
          Reorders the video ID of the videos in the library.
 boolean saveLibraryConfig(java.io.File configXml)
          save configurations to config XML file.
 boolean saveLibraryXml(java.io.File libXml)
          Save this library to an XML file.
 void setAllShownVideos()
          sets all videos in the library to visible to be specific ignores all the filters and lets the table show all the videos in the library.
 void setColumnWidths(int[] reqColumnWidths)
          sets the column widths of the main table with the given int array of sizes.
 void setColumnWidths(java.lang.String stringColumnWidths)
          parses the string of column widths from XML file to import it into this library.
 void setConfigsVersion(java.lang.String reqVersion)
          sets the config version with the given version
 void setDatabaseSearch(boolean databasearchState)
          Sets the online database search mode to on or off.
 void setDefaultMovieInfoDatabaseAddress(java.lang.String reqAddress)
          sets the default address of the movie info database.
 void setHiddenVideo(int videoIndex, boolean status)
          sets the chosen video visibility state to the chosen state.
 void setInDepthImportMode(boolean state)
          Sets the state of the import mode.
In depth import mode off means import will only look for exact math from database, in depth mode on means if no exact match found title will be parsed and detailed search on this parsed title will be done against the database.
 void setLang(java.lang.String reqLang)
          set DVD default language
 void setLibraryVersion(java.lang.String reqVersion)
          sets the library version to the given version
 void setMediaFolder(java.lang.String mediaFolderPath)
          sets the media folder location.
 void setMediaFolderOrganized(boolean state)
          sets the media folder organisation state.
 boolean setMediaPlayerLocation(java.lang.String requiredMediaPlayerLocation)
          sets the location of the media player.
 boolean setMencoderLocation(java.lang.String requiredMencoderLocation)
          sets the location of mencoder in the library.
 void setMovieInfoDbAdd(java.lang.String requiredMovieInfoDbAdd)
          sets the address of the movie info database.
 void setThreads(int reqThreads)
          sets the number of threads to use for converting.
 void setValidVideo(int videoIndex, boolean status)
          sets the path validity for the chosen video.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VideoLibrary

public VideoLibrary()
Constructor for a video library.
Creates a new empty Video library.


VideoLibrary

public VideoLibrary(VideoLibrary reqLibrary)
Creates a new Video Library from another.

Parameters:
reqLibrary - this library is used to create the new library with those settings
Method Detail

setDatabaseSearch

public void setDatabaseSearch(boolean databasearchState)
Sets the online database search mode to on or off.

Parameters:
databasearchState - true to set the database search mode to on, false to switch off.

getDatabaseSearch

public boolean getDatabaseSearch()
Gets the database search mode.

Returns:
the state of database search mode, true is on, false is off.

importLibraryFromXML

public boolean importLibraryFromXML(java.lang.String requiredConfigXML,
                                    java.lang.String requiredLibraryXML)
Method to import information from XML library and configuration XML to this library.
Calls separate methods for each file to check if valid and import them if so.

Parameters:
requiredConfigXML - the path of the configuration XML file to import.
requiredLibraryXML - the path of the library XML file to import.
Returns:
returns true if import successfull otherwise return false.

reorderLibrary

public void reorderLibrary()
Reorders the video ID of the videos in the library.


importConfigXml

public boolean importConfigXml(java.io.File confXML)
Method to read the configuration file and import it into the library.

Parameters:
confXML - the config XML file to import.
Returns:
returns true if import successfull otherwise returns false.

importLibraryXml

public boolean importLibraryXml(java.io.File libXML)
Method to read and import a library XML file to this library.

Parameters:
libXML - library XML file to be read and imported to library .
Returns:
returns true if import successfull otherwise returns false.

saveLibraryXml

public boolean saveLibraryXml(java.io.File libXml)
Save this library to an XML file.

Parameters:
libXml - the XML file the library will be saved to.
Returns:
true if saving successfull otherwise returns false.

saveLibraryConfig

public boolean saveLibraryConfig(java.io.File configXml)
save configurations to config XML file.

Parameters:
configXml - Congiguration XML file the cnfigurations will be saved to.
Returns:
true if save successfull otherwise returns false.

getMediaFolder

public java.lang.String getMediaFolder()
get the media folder path.

Returns:
the pth of the media folder.

getThreads

public int getThreads()
get the threads used for converting (cores of the processor).

Returns:
number of threads to use for converting.

setThreads

public void setThreads(int reqThreads)
sets the number of threads to use for converting.

Parameters:
reqThreads - number of threads to use for converting.

getHiddenVideo

public boolean getHiddenVideo(int videoIndex)
get if the video is hidden to be specific video is filtered out by the media library filters.

Parameters:
videoIndex - index of the video to check visibility state.
Returns:
visibility state of chosen video, true if visible, false if hidden (filtered out).

getValidVideo

public boolean getValidVideo(int videoIndex)
get state of the video path of the selected video.

Parameters:
videoIndex - index of the video to check.
Returns:
state of the path, true if path exists false if it does not.

setValidVideo

public void setValidVideo(int videoIndex,
                          boolean status)
sets the path validity for the chosen video.

Parameters:
videoIndex - index of the video to change its state.
status - validity of the video path for the chosen video.

setHiddenVideo

public void setHiddenVideo(int videoIndex,
                           boolean status)
sets the chosen video visibility state to the chosen state.

Parameters:
videoIndex - index of the chosen video to update its visibility state.
status - visibility of the chosen video.

setAllShownVideos

public void setAllShownVideos()
sets all videos in the library to visible to be specific ignores all the filters and lets the table show all the videos in the library.


getMediaPlayerLocation

public java.lang.String getMediaPlayerLocation()
gets the path of the media player.

Returns:
the path of the media player.

getMencoderLocation

public java.lang.String getMencoderLocation()
gets the location of mencoder .

Returns:
the path of mencoder.

getDefaultMovieInfoDatabaseAddress

public java.lang.String getDefaultMovieInfoDatabaseAddress()
gets the default address of the movie info database.

Returns:
address of the movie info database.

setDefaultMovieInfoDatabaseAddress

public void setDefaultMovieInfoDatabaseAddress(java.lang.String reqAddress)
sets the default address of the movie info database.

Parameters:
reqAddress - address to be set for the movie info database.

getMovieInfoDatabaseAddress

public java.lang.String getMovieInfoDatabaseAddress()
gets the address of the movie info database.

Returns:
address of the movie info database.

isMediaFolderOrganized

public boolean isMediaFolderOrganized()
Returns the organize state of the media folder.
Organized means auto renaming and organising of videos inside the media folder.

Returns:
true if media folder organized automatically otherwise false.

setMediaFolderOrganized

public void setMediaFolderOrganized(boolean state)
sets the media folder organisation state.

Parameters:
state - state of the media folder organisation, true if auto organised otherwise false.

isImportModeInDepth

public boolean isImportModeInDepth()
Gives the state of the import mode.
In depth import mode off means import will only look for exact math from database, in depth mode on means if no exact match found title will be parsed and detailed search on this parsed title will be done against the database.

Returns:
true if in depth import mode otherwise false.

setInDepthImportMode

public void setInDepthImportMode(boolean state)
Sets the state of the import mode.
In depth import mode off means import will only look for exact math from database, in depth mode on means if no exact match found title will be parsed and detailed search on this parsed title will be done against the database.

Parameters:
state - true if in depth import mode on otherwise false.

getPlaylists

public Playlist[] getPlaylists()
returns the playlist stored in this library.

Returns:
array of playlist saved in this library.

setMediaFolder

public void setMediaFolder(java.lang.String mediaFolderPath)
sets the media folder location.

Parameters:
mediaFolderPath - path of the media folder to be set.

getNoOfVideos

public int getNoOfVideos()
gets the number of videos stored in this library.

Returns:
the number of videos stored in this library.

setMediaPlayerLocation

public boolean setMediaPlayerLocation(java.lang.String requiredMediaPlayerLocation)
sets the location of the media player.

Parameters:
requiredMediaPlayerLocation - path of the media player to be set.
Returns:
true if path exists and change was successfull otherwise false.

setMencoderLocation

public boolean setMencoderLocation(java.lang.String requiredMencoderLocation)
sets the location of mencoder in the library.

Parameters:
requiredMencoderLocation - the path of mencoder to be set.
Returns:
true if path exists and change was successfull otherwise false.

setMovieInfoDbAdd

public void setMovieInfoDbAdd(java.lang.String requiredMovieInfoDbAdd)
sets the address of the movie info database.

Parameters:
requiredMovieInfoDbAdd - address to be set for the movie info database.

addNewPlaylist

public boolean addNewPlaylist(java.lang.String playlistName)
adds a new playlist to this library.

Parameters:
playlistName - the name of the playlist to be added .
Returns:
true if adding successfull otherwise false.

addNewVideo

public boolean addNewVideo(VideoObject videoToAdd)
adds a new video to the library, but checks if videos has not been added before first.

Parameters:
videoToAdd - the video to check and add to library.
Returns:
true if adding successfull otherwise false.

deleteVideo

public boolean deleteVideo(int deletionIndex)
deletes the video with the given ID from the library only.

Parameters:
deletionIndex - video ID of the video to be deleted from library.
Returns:
true if deletion successfull otherwise false.

deleteAllVideos

public void deleteAllVideos()
removes all the videos from the library.


getShownVideoCount

public int getShownVideoCount()
gets the number of videos that have not been filtered out by the media library fileters.

Returns:
number of videos not filetered out (not hidden).

changeVideoInfo

public boolean changeVideoInfo(VideoObject newVideo,
                               int videoIndexToBeReplaced)
changes the content of the video with the given ID in the library with the content of the given video.

Parameters:
newVideo - the video content to replace the chosen video ID old video content.
videoIndexToBeReplaced - the video ID of the video to be replaced.
Returns:
true if replace successfull otherwise false.

getVideosList

public VideoObject[] getVideosList()
gets the list of videos stored in the library (filtered out or not).

Returns:
array of videos stored in the library.

getVideo

public VideoObject getVideo(int index)
gets the video with the given video ID.

Parameters:
index - video ID of the video to return.
Returns:
video with chosen ID to return.

getColumnWidths

public int[] getColumnWidths()
get the widths of the columns of the main table.

Returns:
array of int sizes of the columns of the main table.

setColumnWidths

public void setColumnWidths(int[] reqColumnWidths)
sets the column widths of the main table with the given int array of sizes.

Parameters:
reqColumnWidths - int array of column widths to replace previous ones.

setColumnWidths

public void setColumnWidths(java.lang.String stringColumnWidths)
parses the string of column widths from XML file to import it into this library.

Parameters:
stringColumnWidths - string (comma separated values) of column widths to be parsed and imported from the XML config file to the int array of the library.

setLang

public void setLang(java.lang.String reqLang)
set DVD default language

Parameters:
reqLang - language to set to default language

getLang

public java.lang.String getLang()
get DVD default language

Returns:
default DVD language

getLibraryVersion

public java.lang.String getLibraryVersion()
get the library file version

Returns:
the library file version

getConfigsVersion

public java.lang.String getConfigsVersion()
get the configs file version

Returns:
the config file version

setLibraryVersion

public void setLibraryVersion(java.lang.String reqVersion)
sets the library version to the given version

Parameters:
reqVersion - version to set library to

setConfigsVersion

public void setConfigsVersion(java.lang.String reqVersion)
sets the config version with the given version

Parameters:
reqVersion - version to set configs to

getVideosGenres

public java.util.ArrayList<java.lang.String> getVideosGenres()

hideNotSelected

public void hideNotSelected(int videoType,
                            java.lang.String clipType,
                            java.lang.String genre,
                            java.lang.String director,
                            java.lang.String actor,
                            java.lang.String year,
                            java.lang.String seriesName,
                            java.lang.String seasonNo,
                            boolean recalcGenre,
                            boolean recalcDirect,
                            boolean recalcActors,
                            boolean recalcYears)

getFiltersGenres

public java.util.ArrayList<java.lang.String> getFiltersGenres()

getFiltersActors

public java.util.ArrayList<java.lang.String> getFiltersActors()

getFiltersDirectors

public java.util.ArrayList<java.lang.String> getFiltersDirectors()

getFiltersYears

public java.util.ArrayList<java.lang.String> getFiltersYears()

getFiltersSeriesNames

public java.util.ArrayList<java.lang.String> getFiltersSeriesNames()

getFiltersSeasonNos

public java.util.ArrayList<java.lang.String> getFiltersSeasonNos()