tkugelberg / Sonos

Sonos PHP Module for IP-Symcon
7 stars 4 forks source link

SNS_SetPlaylist not working since Sonos update #3

Closed severinbraun closed 1 year ago

severinbraun commented 1 year ago

Updatet to the new module, same Issue:

Since the last Sonos update the function SNS_SetPlaylist is not working anymore.

Play:1: Bad Sonos OS: S2 Version: 15.1.1 (Build 71138240) Hardwareversion: 1.20.1.6-2.1

When sending this request:

SNS_SetPlaylist(59574, "1LIVE");

I get the following error

Fatal error: Uncaught Exception: Error during Soap Call: UPnPError s:Client 800 (UNKNOWN) in /var/lib/symcon/modules/Sonos/libs/sonosAccess.php:801
Stack trace:
#0 /var/lib/symcon/modules/Sonos/libs/sonosAccess.php(26): SonosAccess->processSoapCall('/MediaRenderer/...', 'urn:schemas-upn...', 'AddURIToQueue', Array)
#1 /var/lib/symcon/modules/Sonos/SonosPlayer/module.php(2005): SonosAccess->AddToQueue('x-sonosapi-stre...', '<DIDL-Lite xmln...')
#2 /var/lib/symcon/scripts/__generated.inc.php(1127): SonosPlayer->SetPlaylist('1LIVE')
#3 /var/lib/symcon/scripts/50385.ips.php(2): SNS_SetPlaylist(59574, '1LIVE')
#4 {main}
  thrown in /var/lib/symcon/modules/Sonos/libs/sonosAccess.php on line 801

Would be happy if anyone could fix that in the module.

tkugelberg commented 1 year ago

The fact, that in line 2005 SonosAccess->AddToQueue is executed is indicating, that the playlist was found in SONOS. Can you please enable debugging messages for the player you are using (59574) and provide the output?

Thanks, Thorsten

severinbraun commented 1 year ago

dump.txt

Here is the debug output of the player instance.

tkugelberg commented 1 year ago

Hi,

first I thought the URL of your playlist "x-sonosapi-stream:rpde_svc_379?sid=232&flags=32&sn=2" is an issue. But in my test "x-sonosapi-stream:s24896?sid=254&flags=8224&sn=0" worked fine, so the "x-sonosapi-stream" is not the issue.

So I tried it explicitly:

<?

if(file_exists('../modules/SymconSonos/Sonos/sonosAccess.php')){
  include_once '../modules/SymconSonos/Sonos/sonosAccess.php';
}elseif(file_exists('../modules/Sonos/libs/sonosAccess.php')){
  include_once '../modules/Sonos/libs/sonosAccess.php';
}elseif(file_exists('../modules/.store/de.kugelberg.sonos/libs/sonosAccess.php')){
  include_once '../modules/.store/de.kugelberg.sonos/libs/sonosAccess.php';
}else{
    die('sonosAccess.php not found');
}

// enter your IP here
  $ip = '192.168.1.10';
// 

$sonos = new SonosAccess($ip);

// SWR3, working fine
// $uri = 'x-sonosapi-stream:s24896?sid=254&flags=8224&sn=0';
// $meta = '<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="R:0/0/31" parentID="R:0/0/31" restricted="true"><dc:title>SWR3</dc:title><upnp:class>object.item.audioItem.audioBroadcast</upnp:class><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON65031_</desc></item></DIDL-Lite>';

// 1LIVE failing
$uri = 'x-sonosapi-stream:rpde_svc_379?sid=232&flags=32&sn=2';
$meta = '<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="10090020rpde_svc_379" parentID="100800c4rpde_recently_played" restricted="true"><dc:title>1LIVE</dc:title><upnp:class>object.item.audioItem.audioBroadcast</upnp:class><desc id="cdudn" nameSpace="urn:schemas-rinconnetworks-com:metadata-1-0/">SA_RINCON59399_</desc></item></DIDL-Lite>';

$sonos->AddToQueue($uri, $meta);

and while my SWR3 example is working fine, your URL is failing. Having the APP open while executing it, you should see when the station is set.

Have you tried to start it from the APP? Is it working from there?

Regards, Thorsten

severinbraun commented 1 year ago

Thanks for debugging. It was indeed the URL from Tunein which was the problem. For Both, 1LIVE and Antenne Düsseldorf. Moved both to different URLs now it is working. Thanks a lot!