Queue service
Modify and browse queues
The Queue service is available on these models: v2-S1
/ v2-S13
/ v2-S14
/ v2-S18
/ v2-S21
/ v2-S27
/ v2-S3
/ v2-S33
/ v2-S38
/ v2-S6
/ v2-S9
/ v2-Sub
.
const SonosDevice = require('@svrooij/sonos').SonosDevice
const sonos = new SonosDevice('192.168.x.x')
sonos.QueueService.OneOfTheMethodsBelow({...})
All actions that require input expect an object with the specified parameters, even if it only requires one parameter.
- AddMultipleURIs
- AddURI
- AttachQueue
- Backup
- Browse
- CreateQueue
- RemoveAllTracks
- RemoveTrackRange
- ReorderTracks
- ReplaceAllTracks
- SaveAsSonosPlaylist
- QueueService event
AddMultipleURIs
const result = await sonos.QueueService.AddMultipleURIs({ QueueID:..., UpdateID:..., ContainerURI:..., ContainerMetaData:..., DesiredFirstTrackNumberEnqueued:..., EnqueueAsNext:..., NumberOfURIs:..., EnqueuedURIsAndMetaData:... });
Input object:
property | type | description |
---|---|---|
QueueID | number | |
UpdateID | number | |
ContainerURI | string | |
ContainerMetaData | Track | string | |
DesiredFirstTrackNumberEnqueued | number | |
EnqueueAsNext | boolean | |
NumberOfURIs | number | |
EnqueuedURIsAndMetaData | string |
Output object:
property | type | description |
---|---|---|
FirstTrackNumberEnqueued | number | |
NumTracksAdded | number | |
NewQueueLength | number | |
NewUpdateID | number |
AddURI
const result = await sonos.QueueService.AddURI({ QueueID:..., UpdateID:..., EnqueuedURI:..., EnqueuedURIMetaData:..., DesiredFirstTrackNumberEnqueued:..., EnqueueAsNext:... });
Input object:
property | type | description |
---|---|---|
QueueID | number | |
UpdateID | number | |
EnqueuedURI | string | |
EnqueuedURIMetaData | Track | string | |
DesiredFirstTrackNumberEnqueued | number | |
EnqueueAsNext | boolean |
Output object:
property | type | description |
---|---|---|
FirstTrackNumberEnqueued | number | |
NumTracksAdded | number | |
NewQueueLength | number | |
NewUpdateID | number |
AttachQueue
const result = await sonos.QueueService.AttachQueue({ QueueOwnerID:... });
Input object:
property | type | description |
---|---|---|
QueueOwnerID | string |
Output object:
property | type | description |
---|---|---|
QueueID | number | |
QueueOwnerContext | string |
Backup
const result = await sonos.QueueService.Backup();
This actions returns a boolean whether or not the requests succeeded.
Browse
const result = await sonos.QueueService.Browse({ QueueID:..., StartingIndex:..., RequestedCount:... });
Input object:
property | type | description |
---|---|---|
QueueID | number | |
StartingIndex | number | |
RequestedCount | number |
Output object:
property | type | description |
---|---|---|
Result | string | |
NumberReturned | number | |
TotalMatches | number | |
UpdateID | number |
CreateQueue
const result = await sonos.QueueService.CreateQueue({ QueueOwnerID:..., QueueOwnerContext:..., QueuePolicy:... });
Input object:
property | type | description |
---|---|---|
QueueOwnerID | string | |
QueueOwnerContext | string | |
QueuePolicy | string |
Output object:
property | type | description |
---|---|---|
QueueID | number |
RemoveAllTracks
const result = await sonos.QueueService.RemoveAllTracks({ QueueID:..., UpdateID:... });
Input object:
property | type | description |
---|---|---|
QueueID | number | |
UpdateID | number |
Output object:
property | type | description |
---|---|---|
NewUpdateID | number |
RemoveTrackRange
const result = await sonos.QueueService.RemoveTrackRange({ QueueID:..., UpdateID:..., StartingIndex:..., NumberOfTracks:... });
Input object:
property | type | description |
---|---|---|
QueueID | number | |
UpdateID | number | |
StartingIndex | number | |
NumberOfTracks | number |
Output object:
property | type | description |
---|---|---|
NewUpdateID | number |
ReorderTracks
const result = await sonos.QueueService.ReorderTracks({ QueueID:..., StartingIndex:..., NumberOfTracks:..., InsertBefore:..., UpdateID:... });
Input object:
property | type | description |
---|---|---|
QueueID | number | |
StartingIndex | number | |
NumberOfTracks | number | |
InsertBefore | number | |
UpdateID | number |
Output object:
property | type | description |
---|---|---|
NewUpdateID | number |
ReplaceAllTracks
const result = await sonos.QueueService.ReplaceAllTracks({ QueueID:..., UpdateID:..., ContainerURI:..., ContainerMetaData:..., CurrentTrackIndex:..., NewCurrentTrackIndices:..., NumberOfURIs:..., EnqueuedURIsAndMetaData:... });
Input object:
property | type | description |
---|---|---|
QueueID | number | |
UpdateID | number | |
ContainerURI | string | |
ContainerMetaData | Track | string | |
CurrentTrackIndex | number | |
NewCurrentTrackIndices | string | |
NumberOfURIs | number | |
EnqueuedURIsAndMetaData | string |
Output object:
property | type | description |
---|---|---|
NewQueueLength | number | |
NewUpdateID | number |
SaveAsSonosPlaylist
const result = await sonos.QueueService.SaveAsSonosPlaylist({ QueueID:..., Title:..., ObjectID:... });
Input object:
property | type | description |
---|---|---|
QueueID | number | |
Title | string | |
ObjectID | string |
Output object:
property | type | description |
---|---|---|
AssignedObjectID | string |
QueueService event
const SonosDevice = require('@svrooij/sonos').SonosDevice
const sonos = new SonosDevice('192.168.x.x')
sonos.QueueService.Events('serviceEvent', (data) => {
console.log(data);
});
The QueueService emits events with these properties. Not all properties are emitted every time.
parameter | type | possible values |
---|---|---|
Curated | boolean | |
LastChange | string | |
UpdateID | number |
This file is automatically generated with @svrooij/sonos-docs, do not edit manually.