\duncan3dc\SonosQueue

Provides an interface for managing the queue of a controller.

Summary

Methods
Properties
Constants
__construct()
count()
getTracks()
addTrack()
addTracks()
removeTrack()
removeTracks()
clear()
No public properties found
No constants found
soap()
browse()
getUpdateId()
getNextPosition()
addUris()
$id
$updateId
$controller
$trackFactory
N/A
No private methods found
No private properties found
N/A

Properties

$id

$id : string

Type

string — The unique id of the queue.

$updateId

$updateId : integer

Type

integer — The current update id to be issued with upnp requests.

Methods

count()

count() : integer

The the number of tracks in the queue.

Returns

integer

getTracks()

getTracks(integer  $start, integer  $total) : array<mixed,\duncan3dc\Sonos\Interfaces\TrackInterface>

Get tracks from the queue.

Parameters

integer $start

The zero-based position in the queue to start from

integer $total

The maximum number of tracks to return

Returns

array<mixed,\duncan3dc\Sonos\Interfaces\TrackInterface>

addTrack()

addTrack(string|\duncan3dc\Sonos\Interfaces\UriInterface  $track, integer  $position = null) : $this

Add a track to the queue.

Parameters

string|\duncan3dc\Sonos\Interfaces\UriInterface $track

The URI of the track to add, or an object that implements the UriInterface

integer $position

The position to insert the track in the queue (zero-based), by default the track will be added to the end of the queue

Returns

$this

addTracks()

addTracks(array<mixed,string>|array<mixed,\duncan3dc\Sonos\Interfaces\UriInterface>  $tracks, integer  $position = null) : $this

Add tracks to the queue.

Parameters

array<mixed,string>|array<mixed,\duncan3dc\Sonos\Interfaces\UriInterface> $tracks

An array where each element is either the URI of the tracks to add, or an object that implements the UriInterface

integer $position

The position to insert the tracks in the queue (zero-based), by default the tracks will be added to the end of the queue

Returns

$this

removeTrack()

removeTrack(integer  $position) : boolean

Remove a track from the queue.

Parameters

integer $position

The zero-based position of the track to remove

Returns

boolean

removeTracks()

removeTracks(array<mixed,integer>  $positions) : boolean

Remove tracks from the queue.

Parameters

array<mixed,integer> $positions

The zero-based positions of the tracks to remove

Returns

boolean

clear()

clear() : $this

Remove all tracks from the queue.

Returns

$this

soap()

soap(string  $service, string  $action, array  $params = array()) : mixed

Send a soap request to the controller for this queue.

Parameters

string $service

The service to send the request to

string $action

The action to call

array $params

The parameters to pass

Returns

mixed

browse()

browse(string  $type, integer  $start, integer  $limit = 1) : mixed

Send a browse request to the controller to get queue info.

Parameters

string $type

The type of browse request to send

integer $start

The position to start browsing from

integer $limit

The number of tracks from the queue to return

Returns

mixed

getUpdateId()

getUpdateId() : integer

Get the next update id, or used the previously cached one.

Returns

integer

getNextPosition()

getNextPosition() : integer

Calculate the position number to be used to add a track to the end of the queue.

Returns

integer

addUris()

addUris(array<mixed,\duncan3dc\Sonos\Interfaces\UriInterface>  $tracks, integer  $position = null) : void

Add multiple uris to the queue.

Parameters

array<mixed,\duncan3dc\Sonos\Interfaces\UriInterface> $tracks

The track to add

integer $position

The position to insert the track in the queue (zero-based), by default the track will be added to the end of the queue