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 void
addListDataListener(ListDataListener l)
void
addPropertyChangeListener(PropertyChangeListener propertyChangeListener)
Add a listener.void
addPropertyChangeListener(String property, PropertyChangeListener propertyChangeListener)
Add a listener for a specific property.boolean
contains(Long id)
int
countSongs(Collection<? extends SongFilter> filters)
Returns song count from this playlist, filtered with the given filters.boolean
equals(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.BrowseNode
getBrowseNode()
List<PlayList>
getChildPlayLists()
String
getDescription()
PlayList.Kind
getDistinguishedKind()
Returns the special kind of this playlist.Object
getElementAt(int index)
long
getFileSize()
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.int
getGeniusTrackID()
Long
getId()
This list's id.Long
getIdAt(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.Liking
getLiking()
String
getName()
Long
getParentId()
If this is a sub-folder/playlist, this returns the parent id.PlayList
getParentPlayList()
PlayList[]
getPlayListPath()
Returns path leading to this playlist and ending with it.int
getSize()
String
getSmartCriteria()
String
getSmartInfo()
AudioSong
getSong(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.String
getSortColumnProperty()
Returns the name of the single property the playlist is sorted by.PlayList.SortDirection
getSortDirection()
Return sort direction.String[]
getSortProperties()
Actual sort properties, used inORDER BY
HQL/SQL clauses.String
getSortProperty(int index)
Actual sort property, used inORDER BY
SQL clauses.SpecialPlayListInfo
getSpecialPlayListInfo()
Long
getSpecialPlayListInfoId()
String
getSubstringFilter()
Current substring filter.PlayList.SubstringFilterProperty
getSubstringFilterProperty()
Current property to filter.com.tagtraum.audiokern.bpm.Tempo
getSyncTempo()
When set to a non-null
value,Key
values are displayed as if the song was played back at the given tempo.long
getTotalTime()
Get time with filters applied.int
getUnfilteredSize()
Unfiltered number of songs in playlist.long
getUnfilteredTime()
Get time without any filters applied.int
hashCode()
int
indexOf(Long id)
Returns the first index of the given song.boolean
isAggregateDataAvailable()
Indicates whether we currently have valid aggregate (total size, duration, etc.) data.boolean
isAllItems()
boolean
isAudiobooks()
boolean
isFolder()
boolean
isGeniusPlaylist()
boolean
isLibrary()
Indicates that this is a library playlist, meaning one of the top level library views (e.g.boolean
isMaster()
Indicates whether this playlist is a master playlist.boolean
isMovies()
boolean
isMusic()
boolean
isParentAFolder()
boolean
isPodcasts()
boolean
isPurchasedMusic()
boolean
isSmartPlaylist()
boolean
isSpecialPlayList()
boolean
isTvShows()
boolean
isUserPlaylist()
Indicates that the playlist is just a regular user playlist.boolean
isVideos()
iTunes 6 playlist attribute.void
removeListDataListener(ListDataListener l)
void
removePropertyChangeListener(PropertyChangeListener propertyChangeListener)
Remove a listener.void
setDistinguishedKind(PlayList.Kind distinguishedKind)
Allows setting of a special song type, likePlayList.Kind.PODCASTS
.void
setSortColumnProperty(String property)
Sets "visual/semantic" sort property.void
setSortDirection(PlayList.SortDirection sortDirection)
Sort direction.void
setSortProperties(String... properties)
Sets sort properties.void
setSubstringFilter(String substring, PlayList.SubstringFilterProperty substringFilterProperty)
Sets the filter and which property to filter in one swoop.void
setSyncTempo(com.tagtraum.audiokern.bpm.Tempo syncTempo)
When set to a non-null
value,Key
values are displayed as if the song was played back at the given tempo.String
toString()
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:PlayList
Remove a listener.- Parameters:
propertyChangeListener
- listener
-
addPropertyChangeListener
public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener)
Description copied from interface:PlayList
Add a listener.- Parameters:
propertyChangeListener
- listener
-
addPropertyChangeListener
public void addPropertyChangeListener(String property, PropertyChangeListener propertyChangeListener)
Description copied from interface:PlayList
Add a listener for a specific property.propertyChangeListener
- listener
-
getParentId
public Long getParentId()
Description copied from interface:PlayList
If 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:PlayList
Returns the special kind of this playlist.- Returns:
null
if unknown
-
setDistinguishedKind
public void setDistinguishedKind(PlayList.Kind distinguishedKind)
Description copied from interface:PlayList
Allows 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:PlayList
Returns 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:PlayList
Indicates 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:PlayList
Indicates 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:PlayList
iTunes 6 playlist attribute.- Returns:
- true or false
-
getFilteredSongIds
public List<Long> getFilteredSongIds()
Description copied from interface:PlayList
Returns song ids from this playlist, both sorted and filtered.- Returns:
- song ids
-
getSongIds
public List<Long> getSongIds()
Description copied from interface:PlayList
Returns song ids from this playlist, neither sorted not filtered.- Returns:
- song ids
-
getIndexedSongIds
public IndexedId[] getIndexedSongIds()
Description copied from interface:PlayList
A 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:PlayList
Returns 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:PlayList
Returns songs from this playlist, neither sorted nor filtered.- Returns:
- songs
-
getSongsOrderedBy
public Iterable<AudioSong> getSongsOrderedBy(String sortProperty, PlayList.SortDirection direction)
Description copied from interface:PlayList
Returns 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:PlayList
Returns 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:PlayList
Returns 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:PlayList
Returns songs from this playlist, both sorted and filtered.- Returns:
- songs
-
filteredListIterator
public PlayListIterator<AudioSong> filteredListIterator(int startIndex)
Description copied from interface:PlayList
Creates 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:PlayList
Returns 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:PlayList
Unfiltered 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:PlayList
Returns 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:PlayList
Returns 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:PlayList
Returns 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:PlayList
Returns song from the given index, taking sorting and filtering into account. This method may returnnull
even 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:PlayList
Returns 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:PlayList
Indicates 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:PlayList
Get time with filters applied.- Returns:
- time
-
getUnfilteredTime
public long getUnfilteredTime()
Description copied from interface:PlayList
Get time without any filters applied.- Returns:
- time
-
getFileSize
public long getFileSize()
Description copied from interface:PlayList
Get the sum of all file sizes (with filters applied).- Returns:
- sum of file sizes
-
isAggregateDataAvailable
public boolean isAggregateDataAvailable()
Description copied from interface:PlayList
Indicates 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:PlayList
Returns the name of the single property the playlist is sorted by. Note that for special properties likename
this may not be the same properties as the ones we use forORDER BY
SQL 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:PlayList
Sets "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:PlayList
Actual sort property, used inORDER BY
SQL clauses.- Parameters:
index
- index- Returns:
- property or
null
-
getSortProperties
public String[] getSortProperties()
Description copied from interface:PlayList
Actual sort properties, used inORDER BY
HQL/SQL clauses.- Returns:
- sort properties
-
getSyncTempo
public com.tagtraum.audiokern.bpm.Tempo getSyncTempo()
Description copied from interface:PlayList
When set to a non-null
value,Key
values 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:PlayList
When set to a non-null
value,Key
values 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:PlayList
Sets sort properties.- Parameters:
properties
- sort properties
-
setSortDirection
public void setSortDirection(PlayList.SortDirection sortDirection)
Description copied from interface:PlayList
Sort direction.- Parameters:
sortDirection
- sort direction
-
getSortDirection
public PlayList.SortDirection getSortDirection()
Description copied from interface:PlayList
Return sort direction.- Returns:
- sort direction
-
getSubstringFilter
public String getSubstringFilter()
Description copied from interface:PlayList
Current substring filter.- Returns:
- filter string
-
setSubstringFilter
public void setSubstringFilter(String substring, PlayList.SubstringFilterProperty substringFilterProperty)
Description copied from interface:PlayList
Sets 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:PlayList
Current 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)
-
-