rahims / SoCo

SoCo (Sonos Controller) is a simple Python class that allows you to programmatically control Sonos speakers.
331 stars 33 forks source link

[Random] Some interesting links to look through #33

Closed rahims closed 11 years ago

rahims commented 11 years ago

http://[Sonos player IP]:1400/status

Lot's of interesting information, including the player's temperature and free memory :smiley:

rahims commented 11 years ago

Usernames for all the third-party music services you've set up: http://[Sonos player IP]:1400/status/securesettings

scottgwaters commented 11 years ago

I've actually got new code that will extract the username for the music services. I know how to get pandora stations and play them as well just need some time to implement them. Maybe I'll have some time tonight to throw some code up here for others to play with.

scottgwaters commented 11 years ago

I know 3 is Pandora

rahims commented 11 years ago

Very cool, looking forward to it!

A few more:

2 = Rhapsody 3 = Pandora 11 = Last.fm 1543 = iHeartRadio 2055 = Auepo 2823 = Rdio 3335 = Stitcher Smart Radio 6151 = DAR.fm Record Radio 6663 = Amazon Cloud Player 7431 = Songza 8455 = Murfie 9735 = 7digital

Still needed:

scottgwaters commented 11 years ago
import xml.etree.cElementTree as XML

import requests
import select
import socket
import logging, traceback
import re

response = requests.get('http://192.168.1.59:1400/status/securesettings')

dom = XML.fromstring(response.content)
music_login = dom.findtext('.//Command')
music_login =  XML.fromstring(music_login).attrib['Value']

services_login_list = music_login.split(',')

music_service_credentials = [(services_login_list+[services_login_list[0]])[i:i+4] for i in range(0, len(services_login_list), 4)]

search = '3'
for sublist in music_service_credentials:
    if sublist[0] == search:
        print sublist[1]
        break
scottgwaters commented 11 years ago

This will playback a pandora station.

http://192.168.1.59:1400/MediaRenderer/AVTransport/Control

SOAPACTION: urn:schemas-upnp-org:service:AVTransport:1#SetAVTransportURI

<?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:381332403794797328</CurrentURI>

<CurrentURIMetaData>
&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;OOOX381332403794797328&quot;
 parentID=&quot;0&quot; 
restricted=&quot;true&quot;&gt;&lt;dc:title&gt;
Wolfgang Amadeus Mozart Radio&lt;
/dc:title&gt;&lt;upnp:class&gt;object.item.audioItem.audioBroadcast&lt;
/upnp:class&gt;&lt;desc id=&quot;cdudn&quot; 
nameSpace=&quot;urn:schemas-rinconnetworks-com:metadata-1-0/&quot;&gt;
SA_RINCON3_xxxxxx{insert account email}@gmail.com&lt;
/desc&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;
</CurrentURIMetaData>
</u:SetAVTransportURI></s:Body></s:Envelope>
scottgwaters commented 11 years ago

4359 - Slacker

scottgwaters commented 11 years ago

Also you need to send play command after changing the station.

DPH commented 11 years ago

There is also interesting stuff at http://[Sonos player IP]:1400/xml/device_description.xml Could use this to expand get_speaker_info Cheers David

KennethNielsen commented 11 years ago

As a part of move I though I would close this thread. I have added all this good information to two pages on the wiki of our new location: https://github.com/SoCo/SoCo/wiki