(09.07.2021, 16:57)Erwin van der Zwart Wrote: I created this for Schneider Electric Germany, maybe it is what you are looking for..
I've been using Erwin's script on a Schneider CBUS SHAC (which doesn't have the ability to run apps) with good results, however the old UPNP code doesn't seem to support loading of Apple Music Playlists into the Sonos queue - I suspect because they have a media type of x-rincon-cpcontainer which the Sonos devices treat differently to other playlists or streams.
By chance would you know the the UPNP command to load this playlist type? I've combed through the previously posted variants of the SONOS scripts here on the forum but haven't been able to find a solution.
I think it requires an extra condition here for the mediatype 'x-rincon-cpcontainer' but I'm not sure what the upnp data format is - I suspect a variant of below.
Code:
if mediatype == 'x-sonosapi-stream'then
upnpavcmd(SonosDetails.sonos_ipaddress, 1400, 'SetAVTransportURI', '<CurrentURI>' .. sanitize(FavoritesTable[FavoriteNr].trackuri) .. '</CurrentURI><CurrentURIMetaData>' .. FavoritesTable[FavoriteNr].trackurimetadata .. '</CurrentURIMetaData>')
Here is the URI and MetaData that sonos returns from the playlist / favourite
Code:
["mediatype"]
* string: x-rincon-cpcontainer
["trackuri"]
* string: x-rincon-cpcontainer:1006206clibraryplaylist:p.vB5KhgB44v?sid=204&flags=8300&sn=2
["trackurimetadata"]
* string: <DIDL-Lite xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:upnp="urn:schemas-upnp-org:metadata-1-0/upnp/" xmlns:r="urn:schemas-rinconnetworks-com:metadata-1-0/" xmlns="urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"><item id="1006206clibraryplaylist:p.vB5KhgB44v" parentID="00080024libraryfolder:f.4" restricted="true"><dc:title>Avici</dc:title><upnp:class>object.container.playlistContainer.#PlaylistView</upnp:class><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON52231_X_#Svc52231-0-Token</desc></item></DIDL-Lite>
["description"]
* string: Apple Music Playlist
My attempted update the the code below doesn't work!
Code:
if mediatype == 'x-rincon-cpcontainer' then
upnpavcmd(SonosDetails.sonos_ipaddress, 1400, 'SetAVTransportURI', '<CurrentURI>' .. sanitize(FavoritesTable[FavoriteNr].trackuri) .. '</CurrentURI><CurrentURIMetaData>' .. FavoritesTable[FavoriteNr].trackurimetadata .. '</CurrentURIMetaData>')
Many thanks in advance
Kind Regards
James