Subclass to control the Queue.
MphpD::queue() : Queue
This class is not intended for direct usage.
Use MphpD::queue()
instead to retrieve an instance of this class.
Queue::__construct(FloFaber\MphpD\MphpD $mphpd) : mixed
mixed
Adds the file $uri
to the queue (directories add recursively). $uri
can also be a single file.
Queue::add(string $uri, $pos = -1) : bool
Can be a single file or folder. If connected via Unix socket you may add arbitrary local files (absolute paths)
If set the song is inserted at the specified position. If the parameter starts with + or -, then it is relative to the current song. e.g. +0 inserts right after the current song and -0 inserts right before the current song (i.e. zero songs between the current song and the newly added song).
bool
bool true
on success and false
on failure.
Adds a song to the playlist (non-recursive) and returns the song id.
Queue::add_id(string $uri, $pos = -1) : mixed
Is always a single file or URL
If set the song is inserted at the specified position. If the parameter starts with + or -, then it is relative to the current song. e.g. +0 inserts right after the current song and -0 inserts right before the current song (i.e. zero songs between the current song and the newly added song).
mixed
int|false The song ID on success or false
on failure.
Same as search()
but adds the songs into the Queue at position $pos
.
Queue::add_search(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = [], int $position = -1) : bool
bool
bool true
on success and false
on failure.
Same as find()
but this adds the matching song to the Queue.
Queue::add_find(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = [], int $pos = -1) : bool
Optional. If specified the matched songs will be added to this position in the Queue.
bool
bool true
on success and false
on failure.
Clears the queue
Queue::clear() : bool
bool
bool true
on success and false
on failure.
Deletes a song or a range of songs from the queue
Queue::delete( $p) : bool
The song position or Range
bool
bool true
on success and false
on failure.
Deletes the song with ID $songid
from the Queue
Queue::delete_id(int $songid) : bool
The song ID
bool
bool true
on success and false
on failure.
Moves the song at $from
to $to
in the queue
Queue::move( $from, string $to) : bool
Song position or Range
If starting with + or -, then it is relative to the current song e.g. +0 moves to right after the current song and -0 moves to right before the current song (i.e. zero songs between the current song and the moved range).
bool
bool true
on success and false
on failure.
Moves the song with $from
(songid) to $to
(playlist index) in the queue.
Queue::move_id(int $from, string $to) : bool
Song ID
Playlist Index. If starting with + or -, then it is relative to the current song e.g. +0 moves to right after the current song and -0 moves to right before the current song (i.e. zero songs between the current song and the moved song).
bool
bool true
on success and false
on failure.
Same as Queue::search but case-sensitive
Queue::find(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = []) : mixed
mixed
array|false array
on success or false
on failure.
Returns an associative arrays containing information about the song with ID $songid
.
Queue::get_id(int $songid) : mixed
Song ID
mixed
array|false Associative array
containing song information or false
on failure.
Returns information about all or specific songs in the Queue.
Queue::get( $p = -1) : mixed
Optional. Song Position or Range. If omitted returns an array of associative arrays containing information about all songs in the Queue. If specified returns an associative array containing the given songs information only.
mixed
array|false array
on success or false
on failure. An empty array
is returned if the queue is empty.
Search the queue for matching songs.
Queue::search(FloFaber\MphpD\Filter $filter, string $sort = '', array $window = []) : mixed
The Filter.
If specified the results are sorted by the specified tag.
If specified returns only the given portion.
mixed
array|false array
on success or false
on failure.
Returns an array of changed songs currently in the playlist since $version
.
Queue::changes(int $version, $range = -1, bool $metadata = ) : mixed
The current version can be retrieved with MphpD::status([ "playlist" ])
.
Position of song or Range
If set to true the metadata will be included.
If set to false only the position and ID of the changed songs will be returned.
mixed
array|false array
on success or false
on failure.
Sets the priority of given songs to $priority
.
This only has effect when the random
-mode is enabled.
A higher priority means that it will be played first when random
is enabled.
Queue::prio(int $priority, $range = -1) : bool
Priority 0-255.
Position of song or Range
bool
bool true
on success or false
on failure.
Sets the priority of Song ID $id
to $priority.
This only has effect when the random
-mode is enabled.
A higher priority means that it will be played first when random
is enabled.
Queue::prio_id(int $priority, int $id) : bool
Priority 0-255.
Song ID.
bool
bool true
on success or false
on failure.
Set's the portion of the song that should be played. You can't edit the currently playing song!
Queue::range_id(int $songid, array $range = []) : bool
Song ID.
Range. Start and End are offsets in seconds. If omitted the "play-range" will be removed from the song.
bool
bool true
on success or false
on failure.
Shuffle the Queue.
Queue::shuffle(array $range = []) : bool
If specified only this portion will be shuffled.
bool
bool true
on success or false
on failure.
Swap two songs in Queue. By Position.
Queue::swap(int $songpos_1, int $songpos_2) : bool
bool
bool true
on success or false
on failure.
Swap two songs in Queue. By ID.
Queue::swap_id(int $songid_1, int $songid_2) : bool
First song ID
Second song ID
bool
bool true
on success or false
on failure.
Adds a tag to the specified song
Queue::add_tag_id(int $songid, string $tag, string $value) : bool
Song ID
Tag name
Tag value
bool
bool true
on success or false
on failure.
Removes a tag from the specified song
Queue::clear_tag_id(int $songid, string $tag) : bool
Song ID
Tag name
bool
bool true
on success or false
on failure.