Package com.tagtraum.ubermusic.amazon
Class AmazonPlayList
- java.lang.Object
-
- com.tagtraum.audiokern.ReadOnlyPlayList
-
- com.tagtraum.ubermusic.amazon.AmazonPlayList
-
- All Implemented Interfaces:
PlayList,SyncTempoAware,ListModel
public class AmazonPlayList extends ReadOnlyPlayList
AmazonPlayList.- Author:
- Hendrik Schreiber
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tagtraum.audiokern.PlayList
PlayList.Kind, PlayList.SortDirection, PlayList.SubstringFilterProperty
-
-
Constructor Summary
Constructors Constructor Description AmazonPlayList(BrowseNode browseNode, Supplier<List<AudioSong>> songSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListDataListener(ListDataListener l)voidaddPropertyChangeListener(PropertyChangeListener propertyChangeListener)Add a listener.voidaddPropertyChangeListener(String property, PropertyChangeListener propertyChangeListener)Add a listener for a specific property.booleancontains(Long id)intcountSongs(Collection<? extends SongFilter> filters)Returns song count from this playlist, filtered with the given filters.booleanequals(Object o)int[]filteredIndices(int... unfilteredIndices)Returns the filtered indices (string, order) for the given unfiltered indices.PlayListIterator<AudioSong>filteredListIterator(int startIndex)Creates a dynamically updated iterator for this playlist.BrowseNodegetBrowseNode()List<PlayList>getChildPlayLists()StringgetDescription()PlayList.KindgetDistinguishedKind()Returns the special kind of this playlist.ObjectgetElementAt(int index)longgetFileSize()Get the sum of all file sizes (with filters applied).List<Long>getFilteredSongIds()Returns song ids from this playlist, both sorted and filtered.Iterable<AudioSong>getFilteredSongs()Returns songs from this playlist, both sorted and filtered.intgetGeniusTrackID()LonggetId()This list's id.LonggetIdAt(int index)Returns id of the song at the given index, taking sorting and filtering into account.IndexedId[]getIndexedSongIds()A complete list of sorted ids along with their natural order indices (viaIndexedId.getIndex()).AudioSong.LikinggetLiking()StringgetName()LonggetParentId()If this is a sub-folder/playlist, this returns the parent id.PlayListgetParentPlayList()PlayList[]getPlayListPath()Returns path leading to this playlist and ending with it.intgetSize()StringgetSmartCriteria()StringgetSmartInfo()AudioSonggetSong(int index)Returns song from the given index, taking sorting and filtering into account.List<Long>getSongIds()Returns song ids from this playlist, neither sorted not filtered.List<Long>getSongIds(Set<? extends SongFilter> filters)Returns song ids from this playlist, filtered with the given filters.Iterable<AudioSong>getSongs()Returns songs from this playlist, neither sorted nor filtered.List<AudioSong>getSongs(Collection<? extends SongFilter> filters, int limit)Returns songs from this playlist, filtered with the given filters.Iterable<AudioSong>getSongsOrderedBy(String sortProperty, PlayList.SortDirection direction)Returns songs from this playlist, sorted by the given property.Iterable<AudioSong>getSongsOrderedBy(String sortProperty, PlayList.SortDirection direction, int limit)Returns songs from this playlist, sorted by the given property.StringgetSortColumnProperty()Returns the name of the single property the playlist is sorted by.PlayList.SortDirectiongetSortDirection()Return sort direction.String[]getSortProperties()Actual sort properties, used inORDER BYHQL/SQL clauses.StringgetSortProperty(int index)Actual sort property, used inORDER BYSQL clauses.SpecialPlayListInfogetSpecialPlayListInfo()LonggetSpecialPlayListInfoId()StringgetSubstringFilter()Current substring filter.PlayList.SubstringFilterPropertygetSubstringFilterProperty()Current property to filter.com.tagtraum.audiokern.bpm.TempogetSyncTempo()When set to a non-nullvalue,Keyvalues are displayed as if the song was played back at the given tempo.longgetTotalTime()Get time with filters applied.intgetUnfilteredSize()Unfiltered number of songs in playlist.longgetUnfilteredTime()Get time without any filters applied.inthashCode()intindexOf(Long id)Returns the first index of the given song.booleanisAggregateDataAvailable()Indicates whether we currently have valid aggregate (total size, duration, etc.) data.booleanisAllItems()booleanisAudiobooks()booleanisFolder()booleanisGeniusPlaylist()booleanisLibrary()Indicates that this is a library playlist, meaning one of the top level library views (e.g.booleanisMaster()Indicates whether this playlist is a master playlist.booleanisMovies()booleanisMusic()booleanisParentAFolder()booleanisPodcasts()booleanisPurchasedMusic()booleanisSmartPlaylist()booleanisSpecialPlayList()booleanisTvShows()booleanisUserPlaylist()Indicates that the playlist is just a regular user playlist.booleanisVideos()iTunes 6 playlist attribute.voidremoveListDataListener(ListDataListener l)voidremovePropertyChangeListener(PropertyChangeListener propertyChangeListener)Remove a listener.voidsetDistinguishedKind(PlayList.Kind distinguishedKind)Allows setting of a special song type, likePlayList.Kind.PODCASTS.voidsetSortColumnProperty(String property)Sets "visual/semantic" sort property.voidsetSortDirection(PlayList.SortDirection sortDirection)Sort direction.voidsetSortProperties(String... properties)Sets sort properties.voidsetSubstringFilter(String substring, PlayList.SubstringFilterProperty substringFilterProperty)Sets the filter and which property to filter in one swoop.voidsetSyncTempo(com.tagtraum.audiokern.bpm.Tempo syncTempo)When set to a non-nullvalue,Keyvalues are displayed as if the song was played back at the given tempo.StringtoString()int[]unfilteredIndices(int... filteredIndices)Returns the unfiltered indices for the given filtered (string, order) indices.-
Methods inherited from class com.tagtraum.audiokern.ReadOnlyPlayList
addSongIds, addSongIds, addSongs, addSongs, canAddItem, canInsertItem, getImplementation, isEditable, isItemsEditable, moveSongs, removeAllSongs, removeSongs, removeSongs, setAllItems, setAudiobooks, setChildPlayLists, setDescription, setFolder, setGeniusTrackID, setId, setLiking, setMaster, setMovies, setMusic, setName, setParentId, setParentPlayList, setPodcasts, setPurchasedMusic, setSmartCriteria, setSmartInfo, setSongIds, setSongs, setSpecialPlayListInfo, setTvShows, setVideos
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.tagtraum.audiokern.PlayList
contains, getSongsOrderedBy, indexOf, removeSongs
-
-
-
-
Constructor Detail
-
AmazonPlayList
public AmazonPlayList(BrowseNode browseNode, Supplier<List<AudioSong>> songSupplier)
-
-
Method Detail
-
getBrowseNode
public BrowseNode getBrowseNode()
-
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener propertyChangeListener)
Description copied from interface:PlayListRemove a listener.- Parameters:
propertyChangeListener- listener
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener)
Description copied from interface:PlayListAdd a listener.- Parameters:
propertyChangeListener- listener
-
addPropertyChangeListener
public void addPropertyChangeListener(String property, PropertyChangeListener propertyChangeListener)
Description copied from interface:PlayListAdd a listener for a specific property.propertyChangeListener- listener
-
getParentId
public Long getParentId()
Description copied from interface:PlayListIf this is a sub-folder/playlist, this returns the parent id.- Returns:
- id
-
getSpecialPlayListInfo
public SpecialPlayListInfo getSpecialPlayListInfo()
-
getSpecialPlayListInfoId
public Long getSpecialPlayListInfoId()
-
isSpecialPlayList
public boolean isSpecialPlayList()
-
getDistinguishedKind
public PlayList.Kind getDistinguishedKind()
Description copied from interface:PlayListReturns the special kind of this playlist.- Returns:
nullif unknown
-
setDistinguishedKind
public void setDistinguishedKind(PlayList.Kind distinguishedKind)
Description copied from interface:PlayListAllows setting of a special song type, likePlayList.Kind.PODCASTS.- Parameters:
distinguishedKind- kind
-
isAudiobooks
public boolean isAudiobooks()
Description copied from interface:PlayList
-
isMovies
public boolean isMovies()
Description copied from interface:PlayList
-
isMusic
public boolean isMusic()
Description copied from interface:PlayList
-
isTvShows
public boolean isTvShows()
Description copied from interface:PlayList
-
isPodcasts
public boolean isPodcasts()
Description copied from interface:PlayList
-
getParentPlayList
public PlayList getParentPlayList()
-
getPlayListPath
public PlayList[] getPlayListPath()
Description copied from interface:PlayListReturns path leading to this playlist and ending with it. I.e., the path has at least the length 1.- Returns:
- path of playlists
-
getName
public String getName()
-
getDescription
public String getDescription()
-
getLiking
public AudioSong.Liking getLiking()
-
isMaster
public boolean isMaster()
Description copied from interface:PlayListIndicates whether this playlist is a master playlist. E.g. the (invisible list) Library is typically the master playlist.- Returns:
- true or false
- See Also:
PlayList.isLibrary()
-
isLibrary
public boolean isLibrary()
Description copied from interface:PlayListIndicates that this is a library playlist, meaning one of the top level library views (e.g. Music, AudioBooks, etc.).- Returns:
- true or false
- See Also:
PlayList.isMaster()
-
getGeniusTrackID
public int getGeniusTrackID()
-
isGeniusPlaylist
public boolean isGeniusPlaylist()
-
isAllItems
public boolean isAllItems()
-
getSmartInfo
public String getSmartInfo()
-
isSmartPlaylist
public boolean isSmartPlaylist()
-
getSmartCriteria
public String getSmartCriteria()
-
isVideos
public boolean isVideos()
Description copied from interface:PlayListiTunes 6 playlist attribute.- Returns:
- true or false
-
getFilteredSongIds
public List<Long> getFilteredSongIds()
Description copied from interface:PlayListReturns song ids from this playlist, both sorted and filtered.- Returns:
- song ids
-
getSongIds
public List<Long> getSongIds()
Description copied from interface:PlayListReturns song ids from this playlist, neither sorted not filtered.- Returns:
- song ids
-
getIndexedSongIds
public IndexedId[] getIndexedSongIds()
Description copied from interface:PlayListA complete list of sorted ids along with their natural order indices (viaIndexedId.getIndex()). Natural indices of filtered out objects are flipped:-(index+1)- Returns:
- a complete list of persistent ids along with their natural indices
-
getSongIds
public List<Long> getSongIds(Set<? extends SongFilter> filters)
Description copied from interface:PlayListReturns song ids from this playlist, filtered with the given filters.- Returns:
- song ids
- See Also:
PlayList.getSongs(Collection, int)
-
getSongs
public Iterable<AudioSong> getSongs()
Description copied from interface:PlayListReturns songs from this playlist, neither sorted nor filtered.- Returns:
- songs
-
getSongsOrderedBy
public Iterable<AudioSong> getSongsOrderedBy(String sortProperty, PlayList.SortDirection direction)
Description copied from interface:PlayListReturns songs from this playlist, sorted by the given property.- Parameters:
sortProperty- propertydirection- direction- Returns:
- songs
-
getSongsOrderedBy
public Iterable<AudioSong> getSongsOrderedBy(String sortProperty, PlayList.SortDirection direction, int limit)
Description copied from interface:PlayListReturns songs from this playlist, sorted by the given property.- Parameters:
sortProperty- propertydirection- directionlimit- max number of songs to return- Returns:
- songs
-
getSongs
public List<AudioSong> getSongs(Collection<? extends SongFilter> filters, int limit)
Description copied from interface:PlayListReturns songs from this playlist, filtered with the given filters.- Parameters:
filters- filterslimit- limit, -1 for no limit- Returns:
- songs
- See Also:
PlayList.getSongIds(Set)
-
getFilteredSongs
public Iterable<AudioSong> getFilteredSongs()
Description copied from interface:PlayListReturns songs from this playlist, both sorted and filtered.- Returns:
- songs
-
filteredListIterator
public PlayListIterator<AudioSong> filteredListIterator(int startIndex)
Description copied from interface:PlayListCreates a dynamically updated iterator for this playlist. This iterator will adjust to sort/filter changes to the underlying playlist.
The iterator does not support mutable operations.- Parameters:
startIndex- index to start iterating from, first call toListIterator.next()orListIterator.previous()will produce the song at the given index- Returns:
- read-only, dynamically adjusting list iterator
-
countSongs
public int countSongs(Collection<? extends SongFilter> filters)
Description copied from interface:PlayListReturns song count from this playlist, filtered with the given filters.- Returns:
- song count
- See Also:
PlayList.getSongIds(Set)
-
getUnfilteredSize
public int getUnfilteredSize()
Description copied from interface:PlayListUnfiltered number of songs in playlist. May return-1, if the number is unknown- Returns:
- number of songs in playlist
- See Also:
PlayList.setSubstringFilter(String, PlayList.SubstringFilterProperty)
-
unfilteredIndices
public int[] unfilteredIndices(int... filteredIndices)
Description copied from interface:PlayListReturns the unfiltered indices for the given filtered (string, order) indices.- Parameters:
filteredIndices- filtered indices- Returns:
- unfiltered equivalents
-
filteredIndices
public int[] filteredIndices(int... unfilteredIndices)
Description copied from interface:PlayListReturns the filtered indices (string, order) for the given unfiltered indices.- Parameters:
unfilteredIndices- unfiltered indices- Returns:
- filtered equivalents or
-1, if that does not exist, because the index was filtered out
-
indexOf
public int indexOf(Long id)
Description copied from interface:PlayListReturns the first index of the given song.- Parameters:
id- song id- Returns:
- index or
-1, if not found
-
getSong
public AudioSong getSong(int index)
Description copied from interface:PlayListReturns song from the given index, taking sorting and filtering into account. This method may returnnulleven if a corresponding song exists, because it is loaded asynchronously.
UsePlayList.getIdAt(int), if you need a synchronous result.- Parameters:
index- index- Returns:
- song or
null, if not in the cache or the index is bad - See Also:
PlayList.getIdAt(int)
-
getIdAt
public Long getIdAt(int index)
Description copied from interface:PlayListReturns id of the song at the given index, taking sorting and filtering into account. Other thanPlayList.getSong(int), this method always returns an id, if the index is valid.- Parameters:
index- index- Returns:
- id or null, if the index it not valid
- See Also:
PlayList.getSong(int)
-
contains
public boolean contains(Long id)
-
isFolder
public boolean isFolder()
-
isParentAFolder
public boolean isParentAFolder()
-
isUserPlaylist
public boolean isUserPlaylist()
Description copied from interface:PlayListIndicates that the playlist is just a regular user playlist. Note that Matchlists are not considered regular user playlists.- Returns:
- true or false.
-
isPurchasedMusic
public boolean isPurchasedMusic()
Description copied from interface:PlayList
-
getTotalTime
public long getTotalTime()
Description copied from interface:PlayListGet time with filters applied.- Returns:
- time
-
getUnfilteredTime
public long getUnfilteredTime()
Description copied from interface:PlayListGet time without any filters applied.- Returns:
- time
-
getFileSize
public long getFileSize()
Description copied from interface:PlayListGet the sum of all file sizes (with filters applied).- Returns:
- sum of file sizes
-
isAggregateDataAvailable
public boolean isAggregateDataAvailable()
Description copied from interface:PlayListIndicates whether we currently have valid aggregate (total size, duration, etc.) data. If the data is not available, the asynchronous computation is triggered.- Returns:
- true or false
-
getSortColumnProperty
public String getSortColumnProperty()
Description copied from interface:PlayListReturns the name of the single property the playlist is sorted by. Note that for special properties likenamethis may not be the same properties as the ones we use forORDER BYSQL clauses. But, it's the property that should be highlighted in a UI.- Returns:
- column
-
setSortColumnProperty
public void setSortColumnProperty(String property)
Description copied from interface:PlayListSets "visual/semantic" sort property.- Parameters:
property- name of the property that is marked as sorted-by in the UI- See Also:
PlayList.getSortColumnProperty()
-
getSortProperty
public String getSortProperty(int index)
Description copied from interface:PlayListActual sort property, used inORDER BYSQL clauses.- Parameters:
index- index- Returns:
- property or
null
-
getSortProperties
public String[] getSortProperties()
Description copied from interface:PlayListActual sort properties, used inORDER BYHQL/SQL clauses.- Returns:
- sort properties
-
getSyncTempo
public com.tagtraum.audiokern.bpm.Tempo getSyncTempo()
Description copied from interface:PlayListWhen set to a non-nullvalue,Keyvalues are displayed as if the song was played back at the given tempo. This has consequences for the sort order.- Returns:
- sync tempo
- See Also:
PlayList.setSortProperties(String...)
-
setSyncTempo
public void setSyncTempo(com.tagtraum.audiokern.bpm.Tempo syncTempo)
Description copied from interface:PlayListWhen set to a non-nullvalue,Keyvalues are displayed as if the song was played back at the given tempo. This has consequences for the sort order.- Parameters:
syncTempo- sync tempo
-
setSortProperties
public void setSortProperties(String... properties)
Description copied from interface:PlayListSets sort properties.- Parameters:
properties- sort properties
-
setSortDirection
public void setSortDirection(PlayList.SortDirection sortDirection)
Description copied from interface:PlayListSort direction.- Parameters:
sortDirection- sort direction
-
getSortDirection
public PlayList.SortDirection getSortDirection()
Description copied from interface:PlayListReturn sort direction.- Returns:
- sort direction
-
getSubstringFilter
public String getSubstringFilter()
Description copied from interface:PlayListCurrent substring filter.- Returns:
- filter string
-
setSubstringFilter
public void setSubstringFilter(String substring, PlayList.SubstringFilterProperty substringFilterProperty)
Description copied from interface:PlayListSets the filter and which property to filter in one swoop.- Parameters:
substring- filter stringsubstringFilterProperty- property to filter
-
getSubstringFilterProperty
public PlayList.SubstringFilterProperty getSubstringFilterProperty()
Description copied from interface:PlayListCurrent property to filter.- Returns:
- which property to filter (substring)
- See Also:
PlayList.setSubstringFilter(String, SubstringFilterProperty)
-
getSize
public int getSize()
-
getElementAt
public Object getElementAt(int index)
-
addListDataListener
public void addListDataListener(ListDataListener l)
-
removeListDataListener
public void removeListDataListener(ListDataListener l)
-
-