Subclass to interact with stored Playlists.
MphpD::playlist(string $name) : Playlist
This class is not intended for direct usage.
Use MphpD::playlist() instead to retrieve an instance of this class.
Playlist::__construct(FloFaber\MphpD\MphpD $mphpd, string $name) : mixed
mixed
Function to determine if the specified playlist exists.
Playlist::exists() : bool
bool
bool true if it exists, otherwise false.
Returns a list of all songs in the specified playlist.
Playlist::get_songs(bool $metadata = ) : mixed
If set to true metadata like duration, last-modified,... will be included.
mixed
array|false array of associative Arrays containing song information on success or false on failure.
Loads the specified playlist into the Queue.
Playlist::load(array $range = [], $pos = '') : bool
Range. If specified only the requested portion of the playlist is loaded. Starts at 0.
Specifies where the songs will be inserted into the queue.
Can be relative if prefixed with + or -
bool
bool true on success and false on failure.
Adds $uri to the specified playlist at position $pos.
Playlist::add(string $uri, $pos = '') : bool
Relative file path or other supported URIs.
Specifies where the songs will be inserted into the playlist. Can be relative if prefixed with + or -
bool
bool true on success and false on failure.
Search for songs using Filter and add them into the Playlist at position $pos.
Playlist::add_search(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = [], int $position = -1) : bool
bool
bool
Removes all songs from the specified playlist.
Playlist::clear() : bool
bool
bool true on success and false on failure.
Deletes $songpos from the specified playlist.
Playlist::remove_song( $songpos = -1) : bool
Position of the song or Range
bool
bool true on success and false on failure.
Moves the song at position $from in the specified playlist to the position $to.
Playlist::move_song(int $from, int $to) : bool
Current song position
New song position
bool
bool true on success and false on failure.
Renames the specified playlist to $new_name
Playlist::rename(string $new_name) : bool
New playlist name
bool
bool true on success and false on failure.
Removes the specified playlist from the playlist directory.
Playlist::delete() : bool
bool
bool true on success and false on failure.
Saves the queue to the specified playlist in the playlist directory
Playlist::save(int $mode = 1) : bool
Optional. One of the following:
MPD_MODE_CREATE: The default. Create a new playlist. Fails if a playlist with name $name already exists.
MPD_MODE_APPEND: Append an existing playlist. Fails if a playlist with name $name doesn't already exist. Only supported on MPD v0.24 and newer.
MPD_MODE_REPLACE: Replace an existing playlist. Fails if a playlist with name $name doesn't already exist. Only supported on MPD v0.24 and newer.
bool
bool true on success and false on failure.