java.lang.Object | |||
↳ | java.util.Observable | ||
↳ | fm.audiobox.core.models.Model | ||
↳ | fm.audiobox.core.models.Playlist |
Playlists are the main containers for Media Files and are represented in the system by an unique token.
Internally a Cloud Drive is treated as a Playlist.
There are different types of playlists and each one can represent a particular media storage service, here's a
rundown:
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Playlist()
Instantiates a new Playlist.
| |||||||||||
Playlist(String name)
Instantiates a new Playlist.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Playlist |
addMediaFiles(AudioBoxClient audioBoxClient, List<String> tokens)
Add Media Files to a CustomPlaylist.
| ||||||||||
Playlist |
create(AudioBoxClient audioBoxClient)
Creates a new CustomPlaylist or SmartPlaylist depending on the input parameters.
| ||||||||||
boolean |
destroy(AudioBoxClient audioBoxClient)
Permanently destroy a playlist.
| ||||||||||
final boolean | equals(Object other) | ||||||||||
Albums |
getAlbums(AudioBoxClient audioBoxClient)
Gets media files grouped by albums.
| ||||||||||
Artists |
getArtists(AudioBoxClient audioBoxClient)
Gets media files grouped by albums.
| ||||||||||
String |
getDescription()
Gets this playlist brief description.
| ||||||||||
List<? extends MediaFile> |
getFingerprints(AudioBoxClient audioBoxClient)
Returns known file fingerprints for this playlist.
| ||||||||||
List<? extends MediaFile> |
getFingerprints(AudioBoxClient audioBoxClient, JsonObjectParser parser)
Returns known file fingerprints for this playlist.
| ||||||||||
Genres |
getGenres(AudioBoxClient audioBoxClient)
Gets media files grouped by albums.
| ||||||||||
List<MediaFile> |
getMediaFiles(AudioBoxClient audioBoxClient, long since)
Same as
getMediaFiles(fm.audiobox.core.AudioBoxClient, long, String) but
all media file fields are returned. | ||||||||||
List<MediaFile> |
getMediaFiles(AudioBoxClient audioBoxClient, long since, String set)
Returns media files linked to the specified playlist token along with primary information. | ||||||||||
List<MediaFile> |
getMediaFiles(AudioBoxClient audioBoxClient, long since, String set, JsonObjectParser parser)
Returns media files linked to the specified playlist token along with primary information. | ||||||||||
List<MediaFile> |
getMediaFiles(AudioBoxClient audioBoxClient, JsonObjectParser parser)
Returns media files linked to the specified playlist token along with primary information. | ||||||||||
List<MediaFile> |
getMediaFiles(AudioBoxClient audioBoxClient)
Same as
getMediaFiles(fm.audiobox.core.AudioBoxClient, long, String) but
all media file fields are returned and *no* time filter is applied. | ||||||||||
long |
getMediaFilesCount()
Gets media files count on this playlist.
| ||||||||||
String |
getName()
Gets the playlist name.
| ||||||||||
static String |
getPath()
Gets the generic remote resource path (token interpolation needed,
see
interpolate(String, String) ). | ||||||||||
long |
getPosition()
Gets the position of the playlist (client application should respect this field while sorting playlists).
| ||||||||||
String |
getSystemName()
Gets system name.
| ||||||||||
String |
getToken()
Gets playlist unique token.
| ||||||||||
String |
getType()
Gets the playlist type.
| ||||||||||
String |
getUpdatedAt()
Gets the last time (in form of an UTC String) this playlist have been changed.
| ||||||||||
final int | hashCode() | ||||||||||
boolean |
isCustom()
Checks if the playlist is a custom one.
| ||||||||||
boolean |
isDrive()
Checks if the playlist represents a cloud drive.
| ||||||||||
boolean |
isEmbeddable()
Use this method to check if the playlist is embeddable or not.
| ||||||||||
boolean |
isLastAccessed()
Use this method to check if the playlist is the last one accessed.
| ||||||||||
boolean |
isOffline()
Checks if the playlist is the offline items playlist.
| ||||||||||
boolean |
isSmart()
Checks if the playlist is a smart one.
| ||||||||||
boolean |
isSyncable()
Checks if this playlist supports syncing with remote content, usually valid for external storage services.
| ||||||||||
boolean |
isVisible()
Use this method to check if the playlist is visible or not.
| ||||||||||
Playlist |
removeMediaFiles(AudioBoxClient audioBoxClient, List<String> tokens)
Remove Media Files from a CustomPlaylist.
| ||||||||||
Playlist |
setDescription(String description)
Sets a brief description of the playlist.
| ||||||||||
Playlist |
setEmbeddable(boolean embeddable)
Changes embeddable value, if you want to persist the change
remember to call
update(fm.audiobox.core.AudioBoxClient)
method. | ||||||||||
void |
setLastAccessed(boolean lastAccessed)
Sets as last accessed.
| ||||||||||
void |
setMediaFilesCount(long mediaFilesCount)
Sets media files count.
| ||||||||||
Playlist |
setName(String name)
Changes playlist name, if you want to persist the change
remember to call
update(fm.audiobox.core.AudioBoxClient)
method. | ||||||||||
Playlist |
setPosition(long position)
Changes position value, if you want to persist the change
remember to call
update(fm.audiobox.core.AudioBoxClient)
method. | ||||||||||
void |
setSyncable(boolean syncable)
Sets syncable property.
| ||||||||||
void |
setSystemName(String systemName)
Sets system name.
| ||||||||||
void |
setToken(String token)
Sets token.
| ||||||||||
void |
setType(String type)
Sets type.
| ||||||||||
void |
setUpdatedAt(String updatedAt)
Sets updated at.
| ||||||||||
Playlist |
setVisible(boolean visible)
Changes visible value, if you want to persist the change
remember to call
update(fm.audiobox.core.AudioBoxClient)
method. | ||||||||||
boolean |
sync(AudioBoxClient audioBoxClient)
Begin content sync with the remote platform.
| ||||||||||
boolean |
toggleVisibility(AudioBoxClient audioBoxClient)
Toggle visibility mode for this playlist. | ||||||||||
Playlist |
update(AudioBoxClient audioBoxClient)
Handle the update of a custom or smart playlist.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
fm.audiobox.core.models.Model
| |||||||||||
From class
java.util.Observable
| |||||||||||
From class
java.lang.Object
|
Instantiates a new Playlist.
Default empty constructor.Instantiates a new Playlist.
name | the name of the playlist |
---|
Add Media Files to a CustomPlaylist.
Shallow action that requires a list of media files tokens to be added to this custom playlist. Media files can be added manually only to custom playlists.audioBoxClient | the AudioBoxClient to use for the request |
---|---|
tokens | the list of the tokens string to add to this playlist |
IllegalStateException | if the playlist is not persisted yet. |
---|---|
ResourceNotFoundException | if the playlist not found or not of type CustomPlaylist. |
AudioBoxException | if any of the remote error exception is detected. |
IOException | if any connection problem occurs. |
Creates a new CustomPlaylist or SmartPlaylist depending on the input parameters.
The user can create a CustomPlaylist by setting the playlist name. The user can create a SmartPlaylist by setting the playlist name AND playlist search_params. NOTE: Currently the search_params hash construction is complex enough and therefore it's restricted to the Cloud Web Player, we'll open up the possibility for developers to create them as well.audioBoxClient | the client |
---|
AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Permanently destroy a playlist.
Only Custom and Smart playlists can be destroyed.audioBoxClient | the client to use for the request |
---|
AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Gets media files grouped by albums.
Also includes the same media file entities in other collection views, sorted by the media files' position attribute. ThrowsForbiddenException
if the user is not enabled to view this playlist due
to bad subscription state or missing AudioMash link.
Throws ResourceNotFoundException
if the playlist does not exists.audioBoxClient | the AudioBoxClient to use for the request |
---|
Albums
data.AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Gets media files grouped by albums.
Also includes the same media file entities in other collection views, sorted by the media files' position attribute. ThrowsForbiddenException
if the user is not enabled to view this playlist due
to bad subscription state or missing AudioMash link.
Throws ResourceNotFoundException
if the playlist does not exists.audioBoxClient | the AudioBoxClient to use for the request |
---|
Albums
data.AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Gets this playlist brief description.
Returns known file fingerprints for this playlist. Available only for local and cloud playlist tokens.
Will return all MD5 fingerprints of the media files on this playlist. Useful to know what has already been uploaded.audioBoxClient | the AudioBoxClient to use for the request |
---|
MediaFile
elementsAudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Returns known file fingerprints for this playlist. Available only for local and cloud playlist tokens.
Will return all MD5 fingerprints of the media files on this playlist. Useful to know what has already been uploaded.audioBoxClient | the AudioBoxClient to use for the request |
---|---|
parser | the parser to use to parse the response |
MediaFile
elementsAudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Gets media files grouped by albums.
Also includes the same media file entities in other collection views, sorted by the media files' position attribute. ThrowsForbiddenException
if the user is not enabled to view this playlist due
to bad subscription state or missing AudioMash link.
Throws ResourceNotFoundException
if the playlist does not exists.audioBoxClient | the AudioBoxClient to use for the request |
---|
Albums
data.AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Same as getMediaFiles(fm.audiobox.core.AudioBoxClient, long, String)
but
all media file fields are returned.
Time filter is applied.
audioBoxClient | the client to use for the request |
---|---|
since | unix timestamp that filters the collection and returns records modified since the specified date. |
MediaFile
elementsAudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Returns media files linked to the specified playlist token along with primary information.
This does not return all the attributes for a MediaFile, instead it returns an optimized JSON for fast view-level rendering and parsing purposes. Full details about a particular MediaFile can be obtained by calling the dedicated show endpoint.
Supports a comma separated 'set' parameter which indicates which attributes to render, like 'type,token' so a developer can just ask the needed attributes.
Supports a datetime 'since' parameter that filters the collection and returns records modified since the specified date.
Remote and third party Cloud Storage services' content can be accessed through this endpoint, however an error will be returned if the user has no valid authentication information stored towards the service in question or has an invalid subscription. For example if the user tries to access the Dropbox playlist but he has not the related account linked a ForbiddenException will be thrown, along with the subscription status. Valid subscription statuses are active and trialing.
audioBoxClient | the client to use for the request |
---|---|
since | unix timestamp that filters the collection and returns records modified since the specified date. |
set | comma separated 'set' parameter which indicates which attributes to render, like 'type,token', null will return all available fields. |
MediaFile
elementsAudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Returns media files linked to the specified playlist token along with primary information.
This does not return all the attributes for a MediaFile, instead it returns an optimized JSON for fast view-level rendering and parsing purposes. Full details about a particular MediaFile can be obtained by calling the dedicated show endpoint.
Supports a comma separated 'set' parameter which indicates which attributes to render, like 'type,token' so a developer can just ask the needed attributes.
Supports a datetime 'since' parameter that filters the collection and returns records modified since the specified date.
Remote and third party Cloud Storage services' content can be accessed through this endpoint, however an error will be returned if the user has no valid authentication information stored towards the service in question or has an invalid subscription. For example if the user tries to access the Dropbox playlist but he has not the related account linked a ForbiddenException will be thrown, along with the subscription status. Valid subscription statuses are active and trialing.
audioBoxClient | the client to use for the request |
---|---|
since | unix timestamp that filters the collection and returns records modified since the specified date. |
set | comma separated 'set' parameter which indicates which attributes to render, like 'type,token', null will return all available fields. |
parser | the parser to use to parse the response |
MediaFile
elementsAudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Returns media files linked to the specified playlist token along with primary information.
This does not return all the attributes for a MediaFile, instead it returns an optimized JSON for fast view-level rendering and parsing purposes. Full details about a particular MediaFile can be obtained by calling the dedicated show endpoint.
Supports a comma separated 'set' parameter which indicates which attributes to render, like 'type,token' so a developer can just ask the needed attributes.
Supports a datetime 'since' parameter that filters the collection and returns records modified since the specified date.
Remote and third party Cloud Storage services' content can be accessed through this endpoint, however an error will be returned if the user has no valid authentication information stored towards the service in question or has an invalid subscription. For example if the user tries to access the Dropbox playlist but he has not the related account linked a ForbiddenException will be thrown, along with the subscription status. Valid subscription statuses are active and trialing.
audioBoxClient | the client to use for the request |
---|---|
parser | the parser to use to parse the response |
MediaFile
elementsAudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Same as getMediaFiles(fm.audiobox.core.AudioBoxClient, long, String)
but
all media file fields are returned and *no* time filter is applied.
audioBoxClient | the client to use for the request |
---|
MediaFile
elementsAudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Gets media files count on this playlist.
Gets the playlist name.
Gets the generic remote resource path (token interpolation needed,
see interpolate(String, String)
).
Gets the position of the playlist (client application should respect this field while sorting playlists).
Gets system name.
Gets playlist unique token.
Gets the playlist type.
Gets the last time (in form of an UTC String) this playlist have been changed.
NOTE: Since client timezone may differ significantly you are strongly invited
to always trust and use this datetime in case you are building a sync tool.
Checks if the playlist is a custom one.
Checks if the playlist represents a cloud drive.
Use this method to check if the playlist is embeddable or not.
Use this method to check if the playlist is the last one accessed.
(i.e. getPlaylist(String)
was called at last}
Checks if the playlist is the offline items playlist.
Checks if the playlist is a smart one.
Checks if this playlist supports syncing with remote content, usually valid for external storage services.
Use this method to check if the playlist is visible or not.
Remove Media Files from a CustomPlaylist.
Shallow action that requires a list of media files tokens to be removed from this playlist. Only custom playlist tokens are allowed, being the only ones for which content can be modified.audioBoxClient | the AudioBoxClient to use for the request |
---|---|
tokens | the list of the tokens string to add to this playlist |
IllegalStateException | if the playlist is not persisted yet. |
---|---|
ResourceNotFoundException | if the playlist not found or not of type CustomPlaylist. |
AudioBoxException | if any of the remote error exception is detected. |
IOException | if any connection problem occurs. |
Sets a brief description of the playlist.
description | a brief String to describe this playlist |
---|
Changes embeddable value, if you want to persist the change
remember to call update(fm.audiobox.core.AudioBoxClient)
method.
embeddable | true to mark it as embeddable, false to disable the feature. |
---|
Sets as last accessed. Note: this is a readonly field (when saving this value will be discarded) and the meaning of this method is to populate this object field (i.e. load from persisted playlist).
lastAccessed | true if the playlist was the last accessed. |
---|
Sets media files count. Note: this is a readonly field (when saving this value will be discarded) and the meaning of this method is to populate this object field (i.e. load from persisted playlist).
mediaFilesCount | the media files count |
---|
Changes playlist name, if you want to persist the change
remember to call update(fm.audiobox.core.AudioBoxClient)
method.
name | the name |
---|
Changes position value, if you want to persist the change
remember to call update(fm.audiobox.core.AudioBoxClient)
method.
position | the position to set |
---|
Sets syncable property. Note: this is a readonly field (when saving this value will be discarded) and the meaning of this method is to populate this object field (i.e. load from persisted playlist).
syncable | the syncable |
---|
Sets system name. Note: this is a readonly field (when saving this value will be discarded) and the meaning of this method is to populate this object field (i.e. load from persisted playlist).
systemName | the system name |
---|
Sets token. Note: this is a readonly field (when saving this value will be discarded) and the meaning of this method is to populate this object field (i.e. load from persisted playlist).
token | the token |
---|
Sets type. Note: this is a readonly field (when saving this value will be discarded) and the meaning of this method is to populate this object field (i.e. load from persisted playlist).
type | the type |
---|
Sets updated at. Note: this is a readonly field (when saving this value will be discarded) and the meaning of this method is to populate this object field (i.e. load from persisted playlist).
updatedAt | last time updated |
---|
Changes visible value, if you want to persist the change
remember to call update(fm.audiobox.core.AudioBoxClient)
method.
visible | true to mark it as visible, false to disable the feature. |
---|
Begin content sync with the remote platform. Supported only by syncable playlists.
Calling this method will initiate a job that will synchronize data with the remote storage, such as Dropbox, SkyDrive and others. Playlists supporting official storage such as AudioBox Cloud or AudioBox Desktop does not require syncing.audioBoxClient | the client to use for the request |
---|
SyncException | if any problem occurs. |
---|---|
AudioBoxException | if any of the remote error exception is detected. |
IOException | if any connection problem occurs. |
Toggle visibility mode for this playlist.
By toggling the visibility attribute clients should avoid to render the playlist marked with visible: false or grey them out.
Non visible playlists retains their functionality, they just should be hidden in views.
audioBoxClient | the client to use for the request |
---|
AudioBoxException | if any of the remote error exception is detected. |
---|---|
IOException | if any connection problem occurs. |
Handle the update of a custom or smart playlist.
As a rule of thumb you can have one uniquely named playlist for each type. SmartPlaylist'ssearch_params
can be set only on creation and thus cannot be changed, in this action.
SmartPlaylist cannot be tweaked in their search_params
due to the complexity of their construct.
Since SmartPlaylist are compiled on demand, just destroy the old and create a new one.audioBoxClient | the client |
---|
IllegalStateException | if the playlist is not persisted yet. |
---|---|
ForbiddenException | if no valid subscription found |
ResourceNotFoundException | if playlist is not found or immutable |
ValidationException | if playlist data is not valid (ex: name already taken) |
AudioBoxException | if any of the remote error exception is detected. |
IOException | if any connection problem occurs. |