Skip to main content
Answered

Sonos http API - empty res

  • October 3, 2024
  • 3 replies
  • 137 views

Hi,

I am using the local API via a module in the home automation system Symcon (in my understanding not relevant for the question) and experience an unexpected behaviour for Amazon Music playlist Sonos favorites.

Adding the Sonos favorites for Amazon Music and e.g. Spotify playlists in the Sonos app in the same way leads to different results when browsing the ContentDirectoryService for Sonos favorites(FV:2).

For Spotify playlist the “res” element is delivered so that the playlist can be played via the API.

For Amazon Music playlists the “res” element is returned empty, therefore no possibility to initiate the playback.

Additional difference is that the Amazon Music playlists are listed with r:type “shortcut”, while the Spotify playlists are listed as r:type “instantPlay”.

Via the Sonos App both type of playlists look and behave in the same way.

Does someone have an idea what could be the reason for the different behaviour and what I can do to get the Amazon Music playlists working?

Thanks very much!

Philip

	<item id="FV:2/33"
parentID="FV:2"
restricted="false">
<dc:title>Amazon Music Example</dc:title>
<upnp:class>object.itemobject.item.sonos-favorite</upnp:class>
<r:ordinal>10</r:ordinal>
<res/>
<upnp:albumArtURI>https://m.media-amazon.com/images/I/...</upnp:albumArtURI>
<r:type>shortcut</r:type>
<r:description>Amazon Music</r:description>
<r:resMD><DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:r=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;&lt;item id=&quot;10080044library%2Fplaylists%2F55a60971-ead0-4ec5-b4f2-786f507792f2%2F%23library_playlist&quot; parentID=&quot;10080044library%2Fplaylists%2F55a60971-ead0-4ec5-b4f2-786f507792f2%2F%23library_playlist&quot; restricted=&quot;true&quot;&gt;&lt;dc:title&gt;Amazon Music Example&lt;/dc:title&gt;&lt;upnp:class&gt;object.item&lt;/upnp:class&gt;&lt;desc id=&quot;cdudn&quot; nameSpace=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot;&gt;SA_RINCON51463_X_#Svc51463-3215b0e3-Token&lt;/desc&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</r:resMD>
</item>
<item id="FV:2/35"
parentID="FV:2"
restricted="false">
<dc:title>Spotify Example</dc:title>
<upnp:class>object.itemobject.item.sonos-favorite</upnp:class>
<r:ordinal>11</r:ordinal>
<res protocolInfo="x-rincon-cpcontainer:*:*:*">x-rincon-cpcontainer:1006286cspotify%3Aplaylist%3A3eJIxgKsxCBw2psxVtjg0H?sid=9&amp;flags=10348&amp;sn=7</res>
<upnp:albumArtURI>https://mosaic.scdn.co/640/...</upnp:albumArtURI>
<r:type>instantPlay</r:type>
<r:description>Spotify</r:description>
<r:resMD>&lt;DIDL-Lite xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot; xmlns:r=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot; xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot;&gt;&lt;item id=&quot;1006286cspotify%3Aplaylist%3A3eJIxgKsxCBw2psxVtjg0H&quot; parentID=&quot;1006286cspotify%3Aplaylist%3A3eJIxgKsxCBw2psxVtjg0H&quot; restricted=&quot;true&quot;&gt;&lt;dc:title&gt;Spotify Example&lt;/dc:title&gt;&lt;upnp:class&gt;object.container.playlistContainer&lt;/upnp:class&gt;&lt;desc id=&quot;cdudn&quot; nameSpace=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot;&gt;SA_RINCON2311_X_#Svc2311-5423a0dc-Token&lt;/desc&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</r:resMD>
</item>

 

Best answer by phil81273

thanks for your message!

I did some further investigations and found a solution/workaround foe me, now also the Amazon Music playlists behave the same as Spotify playlists again.

 

If anyone has the same topic, this is the workaoround that resolved it for me:

Whenever I added a Amazon Music playlist with one of my iOS devices, it twas added as “shortcut” and could not be used via the API. I then installed the Windows Sonos app. Amazon Music playlist added to the favorites here appear as “instantPlay” as my Spotify example above. For those I get again content in the res-Element and can start playback via the http API.

This topic has been closed for further comments. You can use the search bar to find a similar topic, or create a new one by clicking Create Topic at the top of the page.

3 replies

controlav
Forum|alt.badge.img+24
  • Lead Maestro
  • October 12, 2024

With Favorites you have to extract the embedded data from resMD to play them, you can’t use the res directly from the results.


controlav
Forum|alt.badge.img+24
  • Lead Maestro
  • October 12, 2024

With Favorites you have to extract the embedded data from resMD to play them, you can’t use the res directly from the results.

See line 83 in https://github.com/amp64/openphonos/blob/main/src/Sonos/UPnPMusicItem.cs


  • Author
  • Contributor I
  • Answer
  • October 13, 2024

thanks for your message!

I did some further investigations and found a solution/workaround foe me, now also the Amazon Music playlists behave the same as Spotify playlists again.

 

If anyone has the same topic, this is the workaoround that resolved it for me:

Whenever I added a Amazon Music playlist with one of my iOS devices, it twas added as “shortcut” and could not be used via the API. I then installed the Windows Sonos app. Amazon Music playlist added to the favorites here appear as “instantPlay” as my Spotify example above. For those I get again content in the res-Element and can start playback via the http API.