Class ITunesLibraryDescriptor
- java.lang.Object
-
- com.tagtraum.beatunes.library.LibraryDescriptor
-
- com.tagtraum.beatunes.library.itunes.ITunesLibraryDescriptor
-
public class ITunesLibraryDescriptor extends LibraryDescriptor
iTunes library descriptor.- Author:
- Hendrik Schreiber
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classITunesLibraryDescriptor.LastModificationComparatorAllows you to compare LibraryDescriptors based on their file's last modification date.
-
Field Summary
Fields Modifier and Type Field Description static Comparator<LibraryDescriptor>LAST_MODIFICATION_COMPARATORAllows you to compare LibraryDescriptors based on their file's last modification date.
-
Constructor Summary
Constructors Constructor Description ITunesLibraryDescriptor(Path file)ITunesLibraryDescriptor(Path file, String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LibraryLoadercreateLibraryLoader()Creates a library loader appropriate for this kind of library.booleanequals(Object o)booleanexists()Indicates whether the library described by this instance actually exists.PathgetFile()StringgetIdAsString()Library id asString.longgetLastModified()If this library descriptor describes a document or is capable of determining the last modification of the library as a whole, this method returns the date.StringgetName()Name.inthashCode()booleanneedsRefresh(long lastSync)Indicates whether we might want to sync this library.StringreadId()voidsetFile(Path file)StringtoString()AudioSongwrap(AudioSong audioSong)Wraps an internal database song into anotherAudioSongthat is capable of writing/reading data to external databases or files (e.g.PlayListwrap(PlayList playList)Wraps an internal database playlist into anotherPlayListthat is capable of writing/reading data to external databases or files.-
Methods inherited from class com.tagtraum.beatunes.library.LibraryDescriptor
getId, getMediaLibrary, setMediaLibrary
-
-
-
-
Field Detail
-
LAST_MODIFICATION_COMPARATOR
public static final Comparator<LibraryDescriptor> LAST_MODIFICATION_COMPARATOR
Allows you to compare LibraryDescriptors based on their file's last modification date. This enables us to pick the newest one of a bunch of library descriptors with the same id. Library descriptors can have the same id, when a library has been moved and the old one is still lying around.After sorting with
Collections.sort(java.util.List, java.util.Comparator)the newest Library descriptor is first.
-
-
Method Detail
-
getName
public String getName()
Description copied from class:LibraryDescriptorName. E.g. "iTunes".- Specified by:
getNamein classLibraryDescriptor- Returns:
- library name
-
readId
public String readId() throws IOException
- Throws:
IOException
-
getFile
public Path getFile()
-
getLastModified
public long getLastModified() throws IOExceptionDescription copied from class:LibraryDescriptorIf this library descriptor describes a document or is capable of determining the last modification of the library as a whole, this method returns the date.- Specified by:
getLastModifiedin classLibraryDescriptor- Returns:
- date of last modification or 0 if unknown
- Throws:
IOException
-
needsRefresh
public boolean needsRefresh(long lastSync) throws IOExceptionDescription copied from class:LibraryDescriptorIndicates whether we might want to sync this library. If this cannot determined accurately, this method returnstrue.- Specified by:
needsRefreshin classLibraryDescriptor- Parameters:
lastSync- date of last sync- Returns:
- true, if we should probably sync
- Throws:
IOException
-
setFile
public void setFile(Path file)
-
getIdAsString
public String getIdAsString()
Description copied from class:LibraryDescriptorLibrary id asString.- Specified by:
getIdAsStringin classLibraryDescriptor- Returns:
- id
- See Also:
PersistentId.idStringToLong(String)
-
exists
public boolean exists()
Description copied from class:LibraryDescriptorIndicates whether the library described by this instance actually exists. Defaults totrue.- Overrides:
existsin classLibraryDescriptor- Returns:
- true or false
-
createLibraryLoader
public LibraryLoader createLibraryLoader()
Description copied from class:LibraryDescriptorCreates a library loader appropriate for this kind of library.- Specified by:
createLibraryLoaderin classLibraryDescriptor- Returns:
- library loader
-
wrap
public AudioSong wrap(AudioSong audioSong)
Description copied from class:LibraryDescriptorWraps an internal database song into anotherAudioSongthat is capable of writing/reading data to external databases or files (e.g.TrackorAudioMetaData). Depending on the kind of library, this wrapper might be quite different.- Specified by:
wrapin classLibraryDescriptor- Parameters:
audioSong- song object to be wrapped, e.g.Song- Returns:
- wrapper
-
wrap
public PlayList wrap(PlayList playList)
Description copied from class:LibraryDescriptorWraps an internal database playlist into anotherPlayListthat is capable of writing/reading data to external databases or files. Depending on the kind of library, this wrapper might be quite different.- Specified by:
wrapin classLibraryDescriptor- Parameters:
playList- song object to be wrapped, e.g.HibernatePlayList- Returns:
- wrapper
-
-