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
@param \MphpD $mphpd
@param string $name
mixed
Function to determine if the specified playlist exists.
Playlist::exists() : bool
bool
bool True if it exists. False if it doesn't.
Returns a list of all songs in the specified playlist.
Playlist::get_songs(bool $metadata = ) : array
@param bool $metadata If set to true metadata like duration, last-modified,... will be included.
array
array|false On success returns an Array of associative Arrays containing song information. False on failure.
Loads the specified playlist into the Queue.
Playlist::load(array $range = [], $pos = '') : bool
@param array $range Range. If specified only the requested portion of the playlist is loaded. Starts at 0.
@param int|string $pos The $pos parameter specifies where the songs will be inserted into the queue.
Can be relative if prefixed with + or -
bool
bool
Adds $uri to the specified playlist at position $pos.
Playlist::add(string $uri, $pos = '') : bool
@param string $uri Relative file path or other supported URIs.
@param int|string $pos Specifies where the songs will be inserted into the playlist. Can be relative if prefixed with + or -
bool
bool Returns 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
@param \Filter $filter
@param string $sort
@param array $window
@param int $position
bool
bool
Removes all songs from the specified playlist.
Playlist::clear() : bool
bool
bool Returns true on success and false on failure.
Deletes $songpos from the specified playlist.
Playlist::remove_song( $songpos = -1) : bool
@param int|array $songpos Position of the song or Range
bool
bool
Moves the song at position $from in the specified playlist to the position $to.
Playlist::move_song(int $from, int $to) : bool
@param int $from
@param int $to
bool
bool
Renames the specified playlist to $new_name
Playlist::rename(string $new_name) : bool
@param string $new_name New playlist name
bool
bool Returns true on success and false on failure
Removes the specified playlist from the playlist directory.
Playlist::delete() : bool
bool
bool
Saves the queue to the specified playlist in the playlist directory
Playlist::save(int $mode = 1) : bool
@param int $mode 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. False on failure.