JSPF
NAME
Audio::Playlist::JSPF - JSON playlist description
SYNOPSIS
use Audio::Playlist::JSPF;
my $playlist = Audio::Playlist::JSPF.new(title => "My New Playlist");
$playlist.track.append: Audio::Playlist::JSPF::Track.new(title => "some track", location => ["http://example.com/mp3"]);
# etc
my $json = $playlist.to-json;
# do something with the JSON
DESCRIPTION
This is a JSON representation of XSPF which is a format for sharing media playlists.
Because this does the role JSON::Class the objects can be created
directly from and serialised to JSON via the from-json
and to-json
methods that role provides.
method add-track
method add-track(*%track-data) returns Track
This is a convenience for adding a new track to the playlist, the named arguments should be the names of the attributes of Track described below, it returns the newly created track object.
attribute title
A human readable title for the playlist.
attribute creator
A human readable name of creator of the playlist.
attribute annotation
Free text annotation or description of the playlist. This should only contain plain text, not markup.
attribute info
The URI of a web page with further information about the playlist.
attribute location
The source URI of the playlist. (i.e. where it can be downloaded)
attribute identifier
The canonical identifier for the playlist, it should be formed as a valid URI but would typically be location independent.
attribute image
The URI of an image that may be displayed in place of a missing image attribute on a track.
attribute date
Creation date of the playlist as a DateTime (this will be parsed from and marshalled as IS08601 from/to JSON)
attribute license
The URI of a license under which the playlist was release.,
attribute attribution
This is a list of Attribution objects, indication the original
location
and identifier
of a Playlist that this playlist may be
based on, with the most recent antecedent first. Typically will be a
maximum of ten items.
attribute track
This an Array of Track objects in the suggested order that they should
be played. The Track
object has the following attributes that describe
the track:
attribute location
An Array of URIs for the resource (typically an audio file or stream,) each URI should refer to a different format or representation of the same source and a client should only use exactly one when playing the playlist.
attribute identifier
A unique and canonical identifier for the track in URI format.
attribute title
The human readable title (or track name.)
attribute creator
The human readable name of the creator of the resource.
attribute annotation
A human readable annotation or description of the resource.
attribute info
A URI of a location where more information about the track can be found.
attribute image
The URI of an image that may be displayed to represent this track. If it is not present the playlist image may be used instead.
attribute album
The human readable name of the "album" or collection from which the track comes from.
attribute track-number
This is the track number from an album or other collection that this track represents.
attribute duration
A Duration object, representing the length of the track, it is converted to/from milliseconds on conversion to/from JSON.