We have moved at community.getvera.com

Author Topic: Sonos plugin and Pandora  (Read 29922 times)

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Sonos plugin - Configuring with Pandora
« Reply #30 on: December 05, 2012, 04:31:38 pm »
I have committed a new change: PlayURI: determine metadataURI from URI for services
As a consequence, it is now possible to call PlayURI for services URI even without knowing the metadataURI. For example, calling PlayURI with "pndrradio:xxxxxxxxx" as URI will play the Pandora radio.

The only requirement is that the service was previously played at least one time in order for the plugin to store few data including the service login.

It is working for tunein and AUPEO! It should work for Pandora. For others services, it should work if these services use the "standard" URI format and not a specific format like Pandora.
« Last Edit: December 05, 2012, 04:33:19 pm by lolodomo »

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Sonos plugin - Configuring with Pandora
« Reply #31 on: December 09, 2012, 04:49:00 am »
Can I have a positive feedback from Hardly Matters  or guessed that you can now play a Pandora radio simply calling PlayURI with URI pndrradio:xxxxxxxxx and that's all ?

Offline Hardly Matters

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Sonos plugin - Configuring with Pandora
« Reply #32 on: December 09, 2012, 10:52:06 am »
Quote
Can I have a positive feedback from Hardly Matters  or guessed that you can now play a Pandora radio simply calling PlayURI with URI pndrradio:xxxxxxxxx and that's all ?

I am not home right now, but will definitely try it and get back to you today.

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Sonos plugin - Configuring with Pandora
« Reply #33 on: December 09, 2012, 11:12:44 am »
@lolodomo,
No URI Device metadata is being passed in, and the Scene causes the Sonos unit to go offline for a few seconds, and then reconnect.

I've run this, and other Pandora stations on that device successfully via the standard [Mac] control application.

Code: [Select]
08 12/09/12 8:03:00.641 JobHandler_LuaUPnP::HandleActionRequest argument URIToPlay=pndrradio:xxxxxxxxxxxxxxxxxx <0x2f661680>
35 12/09/12 8:03:00.642 luup_log:666: Sonos: debug SetAVTransportURI('192.168.6.66', 1400, 'http://%s:%s/MediaRenderer/AVTransport/Control', 'urn:schemas-upnp-org:service:AVTransport:1') Called with parameter count=1 <0x2f661680>
35 12/09/12 8:03:00.643 luup_log:666: Sonos: debug UPnP_request: url=[http://192.168.6.66:1400/MediaRenderer/AVTransport/Control], body=[<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:SetAVTransportURI xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><CurrentURI>pndrradio:xxxxxxxxxxxxxxx</CurrentURI><CurrentURIMetaData></CurrentURIMetaData></u:SetAVTransportURI>
</s:Body>
</s:Envelope>] <0x2f661680>
35 12/09/12 8:03:00.890 luup_log:666: Sonos: debug UPnP_request: status=1 statusMsg=200 result=[<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body><u:SetAVTransportURIResponse xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"></u:SetAVTransportURIResponse></s:Body></s:Envelope>] <0x2f661680>
35 12/09/12 8:03:00.891 luup_log:666: Sonos: debug Play('192.168.6.66', 1400, 'http://%s:%s/MediaRenderer/AVTransport/Control', 'urn:schemas-upnp-org:service:AVTransport:1') Called with parameter count=1 <0x2f661680>
35 12/09/12 8:03:00.892 luup_log:666: Sonos: debug UPnP_request: url=[http://192.168.6.66:1400/MediaRenderer/AVTransport/Control], body=[<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:Play xmlns:u="urn:schemas-upnp-org:service:AVTransport:1"><InstanceID>0</InstanceID><Speed>1</Speed></u:Play>
</s:Body>
</s:Envelope>] <0x2f661680>
35 12/09/12 8:03:02.632 luup_log:666: Sonos: debug refreshNow: start <0x2f661680>
35 12/09/12 8:03:02.633 luup_log:666: Sonos: debug GetZoneAttributes('192.168.6.66', 1400, 'http://%s:%s/DeviceProperties/Control', 'urn:schemas-upnp-org:service:DeviceProperties:1') Called with parameter count=1 <0x2f661680>
35 12/09/12 8:03:02.634 luup_log:666: Sonos: debug UPnP_request: url=[http://192.168.6.66:1400/DeviceProperties/Control], body=[<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:GetZoneAttributes xmlns:u="urn:schemas-upnp-org:service:DeviceProperties:1"><CurrentZoneName></CurrentZoneName><CurrentIcon></CurrentIcon></u:GetZoneAttributes>
</s:Body>
</s:Envelope>] <0x2f661680>
35 12/09/12 8:03:02.637 luup_log:666: Sonos: debug commsFailure: Device offline? status=connection refused <0x2f661680>
06 12/09/12 8:03:02.637 Device_Variable::m_szValue_set device: 666 service: urn:upnp-org:serviceId:AVTransport variable: CurrentStatus was:  now: Cannot contact player #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f661680>

Offline Hardly Matters

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Sonos plugin - Configuring with Pandora
« Reply #34 on: December 09, 2012, 01:15:03 pm »
@lolodomo,
No URI Device metadata is being passed in, and the Scene causes the Sonos unit to go offline for a few seconds, and then reconnect

I have the same results as Guessed. When looking at the devices tab, in the Sonos device box it says something like, "cannot connect to service" for about a second or two and then disappears.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Sonos plugin - Configuring with Pandora
« Reply #35 on: December 09, 2012, 01:56:04 pm »
@guessed: can you trace what's wrong in this code (playURI function):
Code: [Select]
        service, serviceId = getServiceFromURI(uri)
        if (serviceId ~= nil and metaDataKeys[serviceId] ~= nil) then
            uriMetaData = '&lt;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/">&lt;item>&lt;desc>'
                          .. metaDataKeys[serviceId] .. '&lt;/desc>&lt;/item>&lt;/DIDL-Lite>'
        end
Is it serviceId that is nil ?
Or is it metaDataKeys[serviceId] that is nil ?

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Sonos plugin - Configuring with Pandora
« Reply #36 on: December 09, 2012, 02:40:57 pm »
Pandora isn't in the result of getSonosServiceId("Pandora"), so the call to getServiceFromURI(...) results in a nil serviceId.

Looking over the list as you parse it, in getAvailableServices(), I can see that it's missing there also.  So somehow I'm able to use the service, but without it being listed in the Available Services list... definitely odd.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Sonos plugin - Configuring with Pandora
« Reply #37 on: December 09, 2012, 03:07:22 pm »
Pandora isn't in the result of getSonosServiceId("Pandora"), so the call to getServiceFromURI(...) results in a nil serviceId.

Looking over the list as you parse it, in getAvailableServices(), I can see that it's missing there also.  So somehow I'm able to use the service, but without it being listed in the Available Services list... definitely odd.

Yes, that's odd. I don't understand how the Sonos application can show you this service !

Ok, a solution for Pandora would be to assign a special id if not found in the list of services.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Sonos plugin - Configuring with Pandora
« Reply #38 on: December 09, 2012, 04:31:52 pm »
I have committed a little change. Tell me if it is better now for Pandora.

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Sonos plugin - Configuring with Pandora
« Reply #39 on: December 09, 2012, 06:39:09 pm »
I have committed a little change. Tell me if it is better now for Pandora.
Same behavior, the Sonos device disappears for a second, then comes back, but nothing is playing.

Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Sonos plugin - Configuring with Pandora
« Reply #40 on: December 16, 2012, 07:22:10 pm »
Can you trace again to see what's wrong in the code I added to retrieve the Pandora SA_RINCONxxx ?

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Sonos plugin - Configuring with Pandora
« Reply #41 on: December 16, 2012, 10:40:59 pm »
@lolodomo,
I'm running on the latest patched version of the Sonos unit, iPhone/iPad app and Plugin, so a few things have changed since I last tested.

It now correctly plays a Pandora station, from scratch, without triggering a reset.  Don't know which specific item changed to make it start working, but looks like we're set. 

@Hardly Matters:  Can you confirm also?  I'd like to ensure it's not just a quirk of my environment.

Offline Hardly Matters

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
Re: Sonos plugin - Configuring with Pandora
« Reply #42 on: December 17, 2012, 12:26:14 pm »
Quote
@Hardly Matters:  Can you confirm also?  I'd like to ensure it's not just a quirk of my environment.

Confirmed. Working perfectly for me now as well. Awesome!

Offline dinochronos

  • Full Member
  • ***
  • Posts: 116
  • Karma: +0/-0
Re: Sonos plugin - Configuring with Pandora
« Reply #43 on: March 30, 2013, 10:16:51 am »
My plug in works great with the three sonos zones configured  And plays pandora well.

I would like to setup a scene that invokes to play that particular unit or a separate scene to stop play so I can incorporate into a scene that also includes the other devices such as lights scene ie turn on lights and play the sonos unit to what the current music selection is

Any advice?




Offline lolodomo

  • Moderator
  • Master Member
  • *****
  • Posts: 3484
  • Karma: +74/-10
Re: Sonos plugin - Configuring with Pandora
« Reply #44 on: March 30, 2013, 11:13:21 am »
My plug in works great with the three sonos zones configured  And plays pandora well.

I would like to setup a scene that invokes to play that particular unit or a separate scene to stop play so I can incorporate into a scene that also includes the other devices such as lights scene ie turn on lights and play the sonos unit to what the current music selection is

Any advice?

You just have to call the Sonos actions, either from the advanced tab when creating your scene or from the luup tab using luup.call_action.

If your question is more specific, sorry I did not understand exactly what is your specific need.