Functions that call [sonos-device-ip]:1400/status/accounts and parse the resulting XML so I can use the sn, sid and username (looks like a token) of accounts registered on Sonos to format my requests.
What I want to do with it:
In our app a user can browse and queue music on Sonos in two different ways. They can browse Sonos directly and queue music they added via the Sonos app (anything in their Library, Favourites or Playlists). Alternatively they can browse another service they registered within our app (e.g. Spotify) and queue music directly without needing to add anything on Sonos.
I want to queue tracks, playlists or albums for both methods without needing to send music meta info (e.g. track title) along. Sonos should retrieve this info itself (because it obviously can in the Sonos app). The issue I struggle with at the moment is that I don't know how to build valid metaData to send to addURIToQueue. I checked with Wireshark what gets sent from the Sonos app when queueing something but there are still open questions.
the value of the parentID attribute is irrelevant, its presence is not
the dc:title tag is optional, the title is still correct when removed
the upnp:class is either object.item.audioItem.musicTrack for tracks or object.container.album.musicAlbum for playlists or albums
What I don't know yet:
the special ID in front of the URI in the id attribute of the item tag and sometimes between the service prefix (e.g. x-sonos-spotify, x-sonos-http, etc.)
is it fixed? if not what is valid? can I calculate it?
is it different per service?
I hope someone can help me answer my questions. Thanks in advance!
TL;DR
I want to queue tracks/playlists/albums on Sonos by sending only a (slightly formatted) service URI to `addURIToQueue. Examples:
What I added:
Functions that call
[sonos-device-ip]:1400/status/accounts
and parse the resulting XML so I can use thesn
,sid
andusername
(looks like a token) of accounts registered on Sonos to format my requests.What I want to do with it:
In our app a user can browse and queue music on Sonos in two different ways. They can browse Sonos directly and queue music they added via the Sonos app (anything in their Library, Favourites or Playlists). Alternatively they can browse another service they registered within our app (e.g. Spotify) and queue music directly without needing to add anything on Sonos.
I want to queue tracks, playlists or albums for both methods without needing to send music meta info (e.g. track title) along. Sonos should retrieve this info itself (because it obviously can in the Sonos app). The issue I struggle with at the moment is that I don't know how to build valid metaData to send to
addURIToQueue
. I checked with Wireshark what gets sent from the Sonos app when queueing something but there are still open questions.Metadata from Wireshark:
What I found out through experimenting:
object.item.audioItem.musicTrack
for tracks orobject.container.album.musicAlbum
for playlists or albumsWhat I don't know yet:
id
attribute of theitem
tag and sometimes between the service prefix (e.g.x-sonos-spotify
,x-sonos-http
, etc.)I hope someone can help me answer my questions. Thanks in advance!
TL;DR
I want to queue tracks/playlists/albums on Sonos by sending only a (slightly formatted) service URI to `addURIToQueue. Examples:
10032020spotify:track:4myBMnNWZlgvVelYeTu55w
x-sonos-spotify:spotify:track:7ntT9X35Y8FspsqYI2qRi3?sid=9&flags=32&sn=6
x-sonos-http:track%3a227408425.mp3?sid=160&flags=8224&sn=3