Sonos and Spotify

1,340 views
Skip to first unread message

posty

unread,
Jan 4, 2013, 12:39:33 PM1/4/13
to comman...@googlegroups.com
As part of working on the Sonos module for CF I am trying to get information from Spotify.  I am using the code below.  I get a response of Error 400 with an error of what I think is unrecognised SOAPACTION.  However if I cut and paste the exact same SOAPAction and SOAPBody into Fiddler with the same host/url etc and fire it directly at Sonos I get the expected response gzip encrypted.  Anyone see anything I am doing wrong?  I have removed the tag 'sessionID' in the code below so this will not work if you try and cut and paste into Fiddler as the sessionID is my Spotify account so would give anyone access to my account through Sonos if this probelm is solved! BTW this function worked previously although it would appear Sonos modified their Spotify handling in their latest release (this output is taken by looking at the Wireshark traffic in the new Sonos version)

Simon


    self.retrieveMusicFromSpotify = function (callback, DeviceID, DeviceProvider, SessionID, ItemID, StartingIndex, RequestedCount)  {
        var host = "http://spotify.west.sonos-ws-eu.com";
        var url = '/smapi';
        var SOAPAction = "http://www.sonos.com/Services/1.1#getMetadata";
        var SOAPBody = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><credentials xmlns="http://www.sonos.com/Services/1.1"><deviceId>00-0E-58-28-3B-D4:8</deviceId><deviceProvider>Sonos</deviceProvider><sessionId>removed</sessionId></credentials></s:Header><s:Body><getMetadata xmlns="http://www.sonos.com/Services/1.1"><id>root</id><index>0</index><count>100</count></getMetadata></s:Body></s:Envelope>';
        var url = host + url;
        CF.log("url is: " + url);
        CF.log("SOAPAction is : " + SOAPAction);
        CF.log("SOAP Body is: " + SOAPBody + "\r\n");
        CF.request( url, 'POST', {'SOAPAction': SOAPAction}, SOAPBody, function(status, headers, body) {
            if (status == 200) {
                //CF.log("Spotify response is: " + body)
                callback(  body )
            }
            else {
                CF.log('POST failed with status ' + status);
            }
        });
    }

posty

unread,
Jan 4, 2013, 5:47:52 PM1/4/13
to comman...@googlegroups.com
Have wiresharked this further and the only packet level difference I can see is that Sonos sends the http request and it goes as one packet.  When CF sends it goes as two with the first packet carrying the SOAPBody and labelled 'tcp segment of a reassembled pdu'.  This packet goes first and then the packet with the Post etc is sent second.  I am not good enough at the guts of TCPIP to know whether might cause the web server at the other end to process the packets out of sequence and therefore get confused with the SOAPAction request.  Anyone any ideas?

Simon

posty

unread,
Jan 4, 2013, 9:37:34 PM1/4/13
to comman...@googlegroups.com
Should anyone be interested, the problem was that that SOAPAction needed to be enclosed in ' ' so that the double quotes are actually sent in the HTTP request.  The Sonos module is now back on track again.......

Simon

On Friday, January 4, 2013 5:39:33 PM UTC, posty wrote:

Jarrod Bell

unread,
Jan 6, 2013, 10:39:36 PM1/6/13
to comman...@googlegroups.com
Glad you found the answer, I didn't spot it  - quotes can be pesky!

Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To view this discussion on the web visit https://groups.google.com/d/msg/commandfusion/-/Fr-vshW8tTsJ.
To post to this group, send email to comman...@googlegroups.com.
To unsubscribe from this group, send email to commandfusio...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/commandfusion?hl=en.

nouveau depart

unread,
Jan 9, 2013, 2:13:04 AM1/9/13
to comman...@googlegroups.com
Does this mean the sonos plugin is fully working?

posty

unread,
Jan 9, 2013, 7:12:54 PM1/9/13
to comman...@googlegroups.com
It is getting there.  Majority of bits working bar some issues around playing of 'All' in a music source where Sonos must have changed somethings in the last release.  However, current versions of iViewer Next and iViewer TF won't work with it as they have a bug stopping the Sonos discovery working (fixed I believe but awaiting release) and the current iViewer won't work since the Sonos module uses some http request functionality (the Subscribe message) that is only in Next and TF.  Jarrod put this in to make subscribing to Sonos easier.  Summary of all that is even once I fix the current issues it won't work with any iViewer out there!  I happen to have a version of TF that is a couple of versions old which still works hence how I can develop.  When anything changes I will post here!  In reality however, whilst the module is pretty functional, we put it into the CF Github to get a bit of community development behind it and so far no one seems to have shown any interest..........I get to play with it not that often due to work and wife commitments.....any help gratefully received!!!!

Simon

On Friday, January 4, 2013 5:39:33 PM UTC, posty wrote:

posty

unread,
Jan 9, 2013, 8:34:18 PM1/9/13
to comman...@googlegroups.com
New version of TF is lurking around and it has cleared the UDP issue so player discovery now working.  Have uploaded to Github the latest version which still needs a lot of work.  Will however, do grouping, volume (including groups), muting, music sources (most of the time!), show your queue etc. Couple of points to note: a) it is not currently selecting a player when it first starts and you need to do so before you get a music source or nothing will come back, and b) have not bothered with all the queue refreshes at the right places so sometimes although stuff is added to the queue from the music source you need to select the player again to get it to refresh the queue, c) in a group select the top player to control the group, not the zone members, d) think all of the buttons like shuffle, play, repeat etc are working, e) if you want to use Spotify you need to go into musicsources.js and put your spotify ID into where it says in the self declaration and it should work although never tried it with any other ID other than my own.  LastFm may work as I have coded it but I no longer subscribe so can't test it anymore and not high on my list!

All in all version 0.6 so lots to do,  All help and feedback welcome!

Simon

On Friday, January 4, 2013 5:39:33 PM UTC, posty wrote:

DevC

unread,
Jan 10, 2013, 4:44:07 PM1/10/13
to comman...@googlegroups.com
Really looking forward to this, is there anyway to test it without discovery by hardcoding a player or not?

posty

unread,
Jan 10, 2013, 8:08:07 PM1/10/13
to comman...@googlegroups.com
Depends if you are competent at Javascript. You could use a uPNP spy tool to get your player IP addresses and then modify the players.js module to call them directly not using the discovery.js module. I think the HTTP Subscribe used to register with the Sonos players for notification messages will not work in current iViewer but might in iViewer Next. You can get round that by creating a CF System and using cf.send to spoof the http call if necessary. Might be easier to wait for the iViewer Next release derived from the current TF release which is working. Florent or Jarrod might be able to give an ETA?

Whilst I don't really want to rewrite the code just to get around the current release issue, I will give a bit of thought as to an easy way to give a discovery or hard code option as the later would allow working over a VPN which Sonos itself can't without some network traffic fiddling as UDP would not naturally traverse the VPN. Might be useful for me to allow remote development and testing of the app.

Simon

DevC

unread,
Jan 11, 2013, 4:30:49 AM1/11/13
to comman...@googlegroups.com
Unfortunately while my networking knowledge is fine, my JS knowledge is nearly non existent, so I think i will leave that to you and just wait patiently for a working release that I can test. 
Thanks for your work though, cant wait to integrate this

nouveau depart

unread,
Jan 11, 2013, 5:02:26 AM1/11/13
to comman...@googlegroups.com
I would love to test but unfortunately, i don't have a sonos, but i'm considering making the step from itunes to sonos, but therefore i would like a working plugin in iviewer. so i will wait a little and let the guys that already have sonos test, sorry...

2013/1/11 DevC <dchu...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
To view this discussion on the web visit https://groups.google.com/d/msg/commandfusion/-/aJusEDqO01EJ.

posty

unread,
Jan 20, 2013, 3:33:10 PM1/20/13
to comman...@googlegroups.com
Have just put a new version up on github which modified a number of things.  This includes some modes to the GUI to show what is playing in each zone in the zone listing and a settings page where you can put in your Spotify ID and also turn autodiscovery on and off.  If you want it off, you can now add the direct IP addresses of your players and it should then find them.  I have only tested this against iviewer TF so I don't know if it will work with other flavours of iViewer.  Still a few bugs in music sources which I have not yet got round to fixing as it requires some wiresharking.  Anyone who is playing with it, feedback would be great.

In fact, if anyone has tried to play with it, let me know as it would be nice to get some feedback even if it is about bugs!!!!

Jarrod, I know you have a Sonos box so get playing!!!!

Regards

Simon

On Friday, January 4, 2013 5:39:33 PM UTC, posty wrote:

yallah

unread,
Jan 20, 2013, 5:08:42 PM1/20/13
to comman...@googlegroups.com
Hi,

Thx for your plugin, but I can't get any settings windows with Iviewer Next 4.0.233. Nothing appear when I click on gearing.

posty

unread,
Jan 20, 2013, 5:25:13 PM1/20/13
to comman...@googlegroups.com
Try iViewer .237 which should be in your testflight if you have .233. There were still some UDP issues in .233. If you have .237 then auto discovery should work fine.

Simon

yallah

unread,
Jan 20, 2013, 5:30:04 PM1/20/13
to comman...@googlegroups.com
Don't have testflight. Can get only iViewer .233 with appstore:/

Jarrod Bell

unread,
Jan 20, 2013, 5:57:54 PM1/20/13
to comman...@googlegroups.com
iViewer Next is awaiting approval for the App Store. Should be sometime this week. Everyone will have to wait until then to try the Sonos module.

Don't have time at the moment to "play" with things, but will check it out sometime soon. Nice work Simon!


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
 
 

yallah

unread,
Jan 20, 2013, 6:07:04 PM1/20/13
to comman...@googlegroups.com, jar...@commandfusion.com
Oh Great Jarrod,

I will wait ;)

posty

unread,
Jan 21, 2013, 4:37:22 PM1/21/13
to comman...@googlegroups.com
Have just checked discovery etc against iViewer next .237 and all is good if anyone wants to have a play. For some reason the dialog box that I use to do zone grouping is causing CF to crash when you come out of it. Never had this affect before so don't know what it is yet.

Simon

yallah

unread,
Jan 21, 2013, 4:51:11 PM1/21/13
to comman...@googlegroups.com
check with .237 and doesn't work here.

With my computer and Sonos app in iPad, I can get my zone player (ZP90).But when I launch your application nothing happen when I press both synchronizing button on sonos. Can't get any zone. 

After I I do IP manually, still same... (I xheck IP from windows network in media device (sonos connect)

posty

unread,
Jan 21, 2013, 4:58:34 PM1/21/13
to comman...@googlegroups.com
You don't need to press the syncing button on your Sonos device. It should appear after 10secs or so in the left hand panel. You should be running the latest Sonos version on the players as older versions might not get discovered as Sonos have a habit it appears of changing their name.. If you run it in debug mode it will pop up,a message when it tries to subscribe to a player. If nothing pops in 10secs or so then it is not finding your players.

Simon

yallah

unread,
Jan 21, 2013, 5:22:42 PM1/21/13
to comman...@googlegroups.com
same,

I get last version (from yesterday) 

my log: 
> Javascript interface up and running, opening connection with iViewer
> Established connection with iViewer
> Javascript starting up. iViewer version: v4.0.237 build 237
> Initializing modules
> Module found: SONOS_GUI version: 1
> Module found: XML.ObjTree version: 1
> Module found: XML2JSON version: 1
> Module found: Sonos Player version: 1
> Module found: Sonos Players version: 1
> Module found: Sonos Discovery version: 1
> Module found: Utils version: 1
> Module found: SonosMusicSources version: 1
> Starting the Sonos iViewer Application
> Commencing initialisation of Sonos GUI
> Finding Players
> Commencing discovery of Sonos players
> SonosDiscovery: init()

I did upgrade firmware 3.8 for sonos. Still same, I will check my network....

yallah

unread,
Jan 21, 2013, 5:25:18 PM1/21/13
to comman...@googlegroups.com
mix log :

23:18:05> SCRIPT: Javascript interface up and running, opening connection with iViewer
23:18:05> SCRIPT: Established connection with iViewer
23:18:05> SCRIPT: Javascript starting up. iViewer version: v4.0.237 build 237
23:18:05> SCRIPT: Initializing modules
23:18:05> SCRIPT: Module found: SONOS_GUI version: 1
23:18:05> SCRIPT: Module found: XML.ObjTree version: 1
23:18:05> SCRIPT: Module found: XML2JSON version: 1
23:18:05> SCRIPT: Module found: Sonos Player version: 1
23:18:05> SCRIPT: Module found: Sonos Players version: 1
23:18:05> SCRIPT: Module found: Sonos Discovery version: 1
23:18:05> SCRIPT: Module found: Utils version: 1
23:18:05> SCRIPT: Module found: SonosMusicSources version: 1
23:18:05> SCRIPT: Starting the Sonos iViewer Application
23:18:05> SCRIPT: Commencing initialisation of Sonos GUI
23:18:05> SCRIPT: Finding Players
23:18:05> SCRIPT: Commencing discovery of Sonos players
23:18:05> SCRIPT: SonosDiscovery: init()
23:18:06> SSDP Notification9 waiting for incoming connections
23:18:07> SSDP Notification10 waiting for incoming connections
23:18:07> SSDP Notification4 waiting for incoming connections
23:18:07> SSDP Notification12 waiting for incoming connections
23:18:07> SSDP Notification8 waiting for incoming connections
23:18:07> SSDP Notification3 waiting for incoming connections
23:18:07> SSDP Notification7 waiting for incoming connections
23:18:07> SSDP Notification2 failed listening to incoming connections
23:18:07> SSDP Notification11 waiting for incoming connections
23:18:07> SSDP Notification13 waiting for incoming connections
23:18:07> SSDP Notification6 waiting for incoming connections
23:18:07> SSDP Notification1 waiting for incoming connections
23:18:07> SSDP Notification5 waiting for incoming connections
23:18:07> s401 = Not Set
23:18:07> d29 = 1
23:18:07> l14 = 0 items
23:18:07> SSDP Notification2 failed listening to incoming connections
23:18:07> SSDP Notification2 failed listening to incoming connections
23:18:08> SSDP Notification2 failed listening to incoming connections
23:18:09> SSDP Notification2 failed listening to incoming connections
23:18:11> SSDP Notification2 failed listening to incoming connections
23:18:13> SSDP Notification2 failed listening to incoming connections
23:18:15> SSDP Notification2 failed listening to incoming connections
23:18:15> l10 = 0 items
23:18:17> SSDP Notification2 failed listening to incoming connections
23:18:19> SSDP Notification2 failed listening to incoming connections
23:18:21> SSDP Notification2 failed listening to incoming connections
.....

Florent Pillet

unread,
Jan 21, 2013, 5:30:55 PM1/21/13
to comman...@googlegroups.com
Crash? You should not get a crash. Can you please send us the crashlog (send to support at commandfusion dot com) ? Crash logs are synced by iTunes, their location is indicated here https://spreed.zendesk.com/entries/384778-how-to-find-your-ios-crash-logs

Thanks!
Florent

On Jan 21, 2013, at 10:37 PM, posty <simon...@gmail.com> wrote:

> Have just checked discovery etc against iViewer next .237 and all is good if anyone wants to have a play. For some reason the dialog box that I use to do zone grouping is causing CF to crash when you come out of it. Never had this affect before so don't know what it is yet.
>
> Simon
>
> --
>
>

--
Florent Pillet - Software Engineering Lead
www.commandfusion.com



posty

unread,
Jan 21, 2013, 6:50:46 PM1/21/13
to comman...@googlegroups.com
Yallah

Are you technical enough to wireshark? If so run wireshark and then run your Sonos app and look for the UDP MSearch messages and post a copy of this packet if you can. I will also try changing the UPNP search to make it non-Sonos specific, I.e return all UPNP devices, and then filter only Sonos devices. This is less efficient but it will prove whether there is a Sonos naming issue.

Simon

Message has been deleted

posty

unread,
Jan 21, 2013, 7:28:50 PM1/21/13
to comman...@googlegroups.com
Florent

Crashes under both versions.  This dialog has never crashed before.  If you want to look at the code that pops the dialog and processes it, it is all on github on the sonosgui.js file in the self.groupZones function.  Whilst the dialog box will function fine, it crashes when you exit the box which is done by the Done button setting the digital join to the subpage to 0.  Have sent you the crash logs to what I guessed was your email address.  If you don't get them, send me a Skype.  Jarrod has my Skype details.

Florent Pillet

unread,
Jan 22, 2013, 3:20:50 AM1/22/13
to comman...@googlegroups.com
Found & fixed, thanks for the report. Funny that nobody never stumbled upon it before!

Thanks a bunch,
Florent

On Jan 22, 2013, at 1:28 AM, posty <simon...@gmail.com> wrote:

> Crashes under both versions. This dialog has never crashed before. If you want to look at the code that pops the dialog and processes it, it is all on github on the sonosgui.js file in the self.groupZones function. Whilst the dialog box will function fine, it crashes when you exit the box which is done by the Done button setting the digital join to the subpage to 0. Have sent you the crash logs to what I guessed was your email address. If you don't get them, send me a Skype. Jarrod has my Skype details.

yallah

unread,
Jan 22, 2013, 4:59:20 AM1/22/13
to comman...@googlegroups.com
Eheh work perfectly with new update. Thx Simon.

Just another question, where i can find Spotify ID , is it my username ? or other ?

yallah

unread,
Jan 22, 2013, 6:13:16 AM1/22/13
to comman...@googlegroups.com
oh sorry spotify work for me :)

DevC

unread,
Jan 22, 2013, 7:45:48 AM1/22/13
to comman...@googlegroups.com
Got this integrated with my existing project and its working well so far, but although I can see my spotify playlists, i cant actually play anything from them, it just doesnt do anything. Am i missing something?

posty

unread,
Jan 22, 2013, 9:37:43 AM1/22/13
to comman...@googlegroups.com
DevC

Will check when I get home tonight.  Think it works on my iPad at home but as you will note from my earlier posts, the handling of music sources is a major pain and it is not all working.  It requires a lot of wiresharking as what Sonos sends depends upon music provider, whether it is an album, playlist, artist, radio....Lots of permutations and combinations.  Will try and get at least the major spotify things working tonight (I mainly use Spotify so helps me anyhow) if I get time.  If there is anyone out there who knows Sonos technically or has access to any legal docs then it would be great to have.  Wiresharking is a slow and painful process.....

Do you have one or multiple players?

Simon

Waldy,,,, Liverpool Uk

unread,
Jan 22, 2013, 10:23:04 AM1/22/13
to comman...@googlegroups.com

Hi Guys,

Can I just ask a simple question, not to do with Sonos but Spotify.  I don't use Sonos but do use the apple remote app to play my music to different zones using "Airplay" As there isn't an itunes plugin for CF it is messy.

in my Gui I First   Switch on zone though amp
                           Bring PC out of standby
                           Drop out of iviewer
                           run itunes remote app to get my library
                           contol volume through itunes remote app etc

Is there a way to control Spotify through iviewer to save having to do this and does it have airplay so I can just add an airplay speaker somewhere else

Thanks

posty

unread,
Jan 22, 2013, 11:36:58 AM1/22/13
to comman...@googlegroups.com
Don't know but maybe: https://developer.spotify.com/technologies/spotify-play-button/documentation/ might be some form of option?  Don't know about Spotify to AirPlay but Airfoil would probably help.

In a prior life I coauthored the Pronto plugin for iTunes and had mulled over with Jarrod in the past doing something in CF.  However, Sonos has taken over since at a personal level I run my audio world in Sonos now not iTunes.

Simon

DevC

unread,
Jan 22, 2013, 11:41:50 AM1/22/13
to comman...@googlegroups.com
No ive only got the one so far i'm afraid. But any help i can give to fix spotify then i will if i can. Can i check also, now that ive integrgated it into my own project, when you make a change for example to fix spotify, is it a case of updating the JS file or will it be more complex than that? Its just it was a pain to integrate even a little bit into my own project, as its not really a drag and drop module as you find in other remote apps, so therefore updating said "module" could be tricky. id love it if CF could implement the idea of drop in modules for various tasks

posty

unread,
Jan 22, 2013, 8:48:22 PM1/22/13
to comman...@googlegroups.com
Have pushed new release to github which is handling play now, play next, add to queue, and replace queue in music sources properly.  In general it will currently handle Music Library, Spotify and potentially Sonos Playlists.  Radio and LastFm dead currently although were working!  Known bugs which I have yet to solve seems to be handling of name with funny characters such 'NSync which it seems to just not put in the queue and also more of a pain is the disappearing of all the music sources content. The only way round this latter bug is to restart the CF session.

In terms of your question DevC about merging the gui, 90% of the time it will just be copying new .js files in.  However, when the GUI file changes not sure there is an easy answer that I know of.  Sadly, this release does a have a GUI file change as I had to change the join numbers of a couple of buttons to get round the bug identified a couple of posts above with Florent.

Regards

Simon

DevC

unread,
Jan 23, 2013, 5:23:06 AM1/23/13
to comman...@googlegroups.com
ok, well in this case its actually probably easier if you can tell me the changes you made and then i can edit the gui files and the join numbers, is that possible?

Thanks

JohanJ

unread,
Jan 23, 2013, 5:25:55 AM1/23/13
to comman...@googlegroups.com

Den onsdagen den 23:e januari 2013 kl. 11:23:06 UTC+1 skrev DevC:
ok, well in this case its actually probably easier if you can tell me the changes you made and then i can edit the gui files and the join numbers, is that possible?

Gui files are just text files, make a diff of the two files and you will see what has changed.

DevC

unread,
Jan 23, 2013, 4:37:16 PM1/23/13
to comman...@googlegroups.com
i cant do a diff because i have modified the original gui file to fit in my project, so if i do a diff it will wipe out all my changes

DevC

unread,
Jan 23, 2013, 5:18:24 PM1/23/13
to comman...@googlegroups.com
ok ive made the gui file changes in my project and replaced the JS files with the latest, but still when i try spotify and select a song, it just does nothing. Although the play now/next etc pop up disappears correctly


On Wednesday, January 23, 2013 1:48:22 AM UTC, posty wrote:

posty

unread,
Jan 23, 2013, 5:50:47 PM1/23/13
to comman...@googlegroups.com
Have you selected a player? Does the music library work?

Simon

DevC

unread,
Jan 23, 2013, 6:34:01 PM1/23/13
to comman...@googlegroups.com
i don thave any songs on the music library. and i thought it plays by default on the auto configured player? thats how the radio worked before?

posty

unread,
Jan 24, 2013, 5:08:46 AM1/24/13
to comman...@googlegroups.com
OK.  If I get a chance tonight I will drop a version with some more debugging turned on to see what it is sending although I think it is already outputting the actual URI it calls in the debugger.  Perhaps you could paste this in.  Can you run wireshark and if so send me a wireshark conversation between your Sonos App and the player including some Spotify playlist and track selection traffic etc. By comparing that to what the URI it is sending, should be possible to see the difference.  Also, if you are happy to share your GUI with me, I can load it up in my world to see if it works fine in a known environment.  We can set up a dropbox share if necessary to swap things.

Simon

On Friday, January 4, 2013 5:39:33 PM UTC, posty wrote:
As part of working on the Sonos module for CF I am trying to get information from Spotify.  I am using the code below.  I get a response of Error 400 with an error of what I think is unrecognised SOAPACTION.  However if I cut and paste the exact same SOAPAction and SOAPBody into Fiddler with the same host/url etc and fire it directly at Sonos I get the expected response gzip encrypted.  Anyone see anything I am doing wrong?  I have removed the tag 'sessionID' in the code below so this will not work if you try and cut and paste into Fiddler as the sessionID is my Spotify account so would give anyone access to my account through Sonos if this probelm is solved! BTW this function worked previously although it would appear Sonos modified their Spotify handling in their latest release (this output is taken by looking at the Wireshark traffic in the new Sonos version)

Simon


    self.retrieveMusicFromSpotify = function (callback, DeviceID, DeviceProvider, SessionID, ItemID, StartingIndex, RequestedCount)  {
        var host = "http://spotify.west.sonos-ws-eu.com";
        var url = '/smapi';
        var SOAPAction = "http://www.sonos.com/Services/1.1#getMetadata";
        var SOAPBody = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><credentials xmlns="http://www.sonos.com/Services/1.1"><deviceId>00-0E-58-28-3B-D4:8</deviceId><deviceProvider>Sonos</deviceProvider><sessionId>removed</sessionId></credentials></s:Header><s:Body><getMetadata xmlns="http://www.sonos.com/Services/1.1"><id>root</id><index>0</index><count>100</count></getMetadata></s:Body></s:Envelope>';
        var url = host + url;
        CF.log("url is: " + url);
        CF.log("SOAPAction is : " + SOAPAction);
        CF.log("SOAP Body is: " + SOAPBody + "\r\n");
        CF.request( url, 'POST', {'SOAPAction': SOAPAction}, SOAPBody, function(status, headers, body) {
            if (status == 200) {
                //CF.log("Spotify response is: " + body)
                callback(  body )
            }
            else {
                CF.log('POST failed with status ' + status);
            }
        });
    }

DevC

unread,
Jan 24, 2013, 5:27:59 AM1/24/13
to comman...@googlegroups.com
ok im happy to share it, but wont be till a bit later on as im busy with work right now, so if you want to set up a dropbox shared folder I can upload to that

posty

unread,
Jan 24, 2013, 10:22:35 AM1/24/13
to comman...@googlegroups.com
DevC - will need your email to do the dropbox.  Will also need the wireshark to make any sense of anything.  Send me your email to my email.  My name is simon, my surname post and it is a me.com address.

Simon

posty

unread,
Jan 25, 2013, 7:53:35 PM1/25/13
to comman...@googlegroups.com
DevC

Think I may have found the problem.  Have posted a new version of musicsource.js on github.  Try copying this in and let me know if it works.  Have worked out now how Sonos actually works out what music sources you are subscribed to and various other things so I think I can automate spotify user IDs etc.  Will work on it over the weekend.  Sadly I think musicsource.js needs a complete rethink with this knowledge and to make it more bullet proof...........next weekends task!

Simon

Jarrod Bell

unread,
Jan 25, 2013, 8:30:34 PM1/25/13
to comman...@googlegroups.com
Great work Simon! Really appreciate the effort you're putting into this and sharing with the community.

Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


--
 
 

posty

unread,
Jan 26, 2013, 9:21:35 PM1/26/13
to comman...@googlegroups.com, jar...@commandfusion.com
I am trying to use xpath to parse the xml below and can not get it to work at all.  It is something to do with the namespaces I believe.  If anyone can parse it and can share the code it would speed up the Sonos module no end!! :)

Simon


<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/"><container id="A:ARTIST" parentID="A:" restricted="true"><dc:title>Contributing Artists</dc:title><upnp:class>object.container</upnp:class><res protocolInfo="x-rincon-playlist:*:*:*">x-rincon-playlist:RINCON_000E58283BD401400#A:ARTIST</res></container><container id="A:ALBUMARTIST" parentID="A:" restricted="true"><dc:title>Artists</dc:title><upnp:class>object.container</upnp:class><res protocolInfo="x-rincon-playlist:*:*:*">x-rincon-playlist:RINCON_000E58283BD401400#A:ALBUMARTIST</res></container><container id="A:ALBUM" parentID="A:" restricted="true"><dc:title>Albums</dc:title><upnp:class>object.container.albumlist</upnp:class><res protocolInfo="x-rincon-playlist:*:*:*">x-rincon-playlist:RINCON_000E58283BD401400#A:ALBUM</res></container><container id="A:GENRE" parentID="A:" restricted="true"><dc:title>Genres</dc:title><upnp:class>object.container</upnp:class><res protocolInfo="x-rincon-playlist:*:*:*">x-rincon-playlist:RINCON_000E58283BD401400#A:GENRE</res></container><container id="A:COMPOSER" parentID="A:" restricted="true"><dc:title>Composers</dc:title><upnp:class>object.container</upnp:class><res protocolInfo="x-rincon-playlist:*:*:*">x-rincon-playlist:RINCON_000E58283BD401400#A:COMPOSER</res></container><container id="A:TRACKS" parentID="A:" restricted="true"><dc:title>Tracks</dc:title><upnp:class>object.container.playlistContainer</upnp:class><res protocolInfo="x-rincon-playlist:*:*:*">x-rincon-playlist:RINCON_000E58283BD401400#A:TRACKS</res></container><container id="A:PLAYLISTS" parentID="A:" restricted="true"><dc:title>Playlists</dc:title><upnp:class>object.container</upnp:class></container></DIDL-Lite>

DevC

unread,
Jan 29, 2013, 9:17:13 AM1/29/13
to comman...@googlegroups.com, jar...@commandfusion.com
the new musicsource.js works with spotify, i can play music, but while "play now" works, the others like "play next" and add to queue etc, they all seem to start the selection straight away. Even though it does ad it to the queue, it doesnt respect its queue position, just plays straight away.

Next bug: If you play a song and then let it move to the next song in the queue when the first song finishes, the track info doesnt update and the progress bar doesnt reset for the new song, the time just keeps increasing.

havent tested much else yet but will keep trying

posty

unread,
Feb 5, 2013, 5:24:38 PM2/5/13
to comman...@googlegroups.com
Have done major rewrite of music sources which works faster and cures the issue Devc was having. Music library, Spotify and Sonos playlists appear to work at least in my setup. Got an issue with radio that I am working through with wireshark. Will post new version after weekend.

Joep van den Aker

unread,
Feb 6, 2013, 2:43:42 AM2/6/13
to comman...@googlegroups.com
Great Job!
I'm looking forward to test it.


Op 5 feb. 2013 om 23:24 heeft posty <simon...@gmail.com> het
volgende geschreven:

> Have done major rewrite of music sources which works faster and cures the issue Devc was having. Music library, Spotify and Sonos playlists appear to work at least in my setup. Got an issue with radio that I am working through with wireshark. Will post new version after weekend.
>
> --
> You received this message because you are subscribed to the Google Groups "CommandFusion Software" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to commandfusio...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

posty

unread,
Feb 9, 2013, 1:53:26 AM2/9/13
to comman...@googlegroups.com
New version uploaded with reworked music sources and hopefully a few bug fixes.  There changes in the GUI file as well as the JS files so unfortunately it will be necessary to remerge the GUI file if you have put it in your own GUI.

Simon

yallah

unread,
Feb 9, 2013, 2:22:30 AM2/9/13
to comman...@googlegroups.com
Great Job Simon!

Have question, is it possible search artist or album from spotify yet?

posty

unread,
Feb 9, 2013, 5:00:01 AM2/9/13
to comman...@googlegroups.com
No but search is my next task. Will probably get a chance to look at it this weekend.

Simon

posty

unread,
Feb 10, 2013, 5:07:24 AM2/10/13
to comman...@googlegroups.com
Search is now working for Music Library items and Spotify. However, whilst making search work I noticed Sonos will play all tracks in a playlist but not individual ones. Bugette! Will fix it when I finalise search which I hope to do tonight.

Simon

posty

unread,
Feb 10, 2013, 5:54:08 PM2/10/13
to comman...@googlegroups.com
Just pushed a new version that has search enabled for Spotify and Music Library.  There appears to be the odd bug around queue handling (may need a rewrite as it has been hacked around a bit) but in general I think selecting, playing and searching are now working OK.  Other functions such as grouping and volume etc have not been touched so should all still be OK.  Search works like the Sonos app, that is to say once you select a music source, the search icon changes to that source and you can then type in what you want and it will pull back albums, artists and tracks.  Once you have selected a search item, the search functionality goes away until you click the search field and edit the text.  I don't know how in CommandFusion to get an event when you enter the search field which would be useful as at the moment you have to change the text to get the search to occur.  It will make sense of you try it..........

Let me know of any bugs anyone finds.........

Simon

Joep

unread,
Feb 11, 2013, 4:47:56 AM2/11/13
to comman...@googlegroups.com
Hi Simon,
 
I have just tested the latest version on an iPad1 and iPad2 with the newest iViewer next and i have noticed that Music source doesn't work.
I can't select any source like the music library or tunein radio, there are no buttons visible to select.
When i hit the search i can add some text by the popup keyboard and when i hit enter there are some more buttons visible called 'Albums' 'Artists' and 'Tracks' but part from that there's nothing happened.
I also found out that there is no good synch between the desktop controller and the iPads. I need to do a manual refresh by clicking the zone on the left on the iPad.
And it would be nice if you could swipe the timeline bar to do some ffwd function like posible in the desktop controller.
 
Great job!

Op zondag 10 februari 2013 23:54:08 UTC+1 schreef posty het volgende:

posty

unread,
Feb 11, 2013, 6:39:35 AM2/11/13
to comman...@googlegroups.com
Joep

Did you copy in the file musicsourcev2.js?  If you did, run the file with the debugger and send me your log.  Are you running the latest Sonos firmware.

Simon

Joep van den Aker

unread,
Feb 11, 2013, 11:15:27 AM2/11/13
to comman...@googlegroups.com
Hi Simon,
 
I downloaded the latest Github zip file, extracted it and opened the project then uploaded and tested it.
Please find attached the log files.
Hope that will help.
 
Thank in advance..
2013/2/11 posty <simon...@gmail.com>

--
script log.txt
mixed log.txt

posty

unread,
Feb 11, 2013, 1:06:34 PM2/11/13
to comman...@googlegroups.com
Joep

Looks like you have no music services and it was not trapping for this.  I have now trapped this and tested on my setup by unsubscribing my music sources.  Have ago with the latest github.........  This is still very much a development in progress and does not seem to be much support from the community so you'll have to bear with me as I go.  My coding style is to play to make it work and then recode when I have understood what is going on.  Probably not very good but I am too long in the tooth to change now!

Simon

Joep van den Aker

unread,
Feb 11, 2013, 2:08:24 PM2/11/13
to comman...@googlegroups.com
No problem. I appricate your hard work!
I thought without adding any music service it would also 'see' my music library and Tunein radio?
At least that's what i hope it can do..

posty

unread,
Feb 11, 2013, 2:21:23 PM2/11/13
to comman...@googlegroups.com
It should if it works......

Jarrod Bell

unread,
Feb 11, 2013, 5:46:31 PM2/11/13
to comman...@googlegroups.com
I hope to be able to offer some help in the development process, and we just pushed a major update to our website so might free me up a bit to hopefully help out with some stuff like this.
Even if it's just cleaning up UI stuff to start with. There are many Sonos users that appreciate the hard work you are doing Simon!


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


Joep

unread,
Feb 12, 2013, 2:50:04 AM2/12/13
to comman...@googlegroups.com, jar...@commandfusion.com
Hi Simon,
 
With the last update it works, thanks!
What doesn't work is the search function when using Tunein radio.
I also miss 2 buttons from Tunein: favorites and local radio i'm not shure if it's possible to add them but it would be nice if you could.
Another small bug i've noticed is that when playing an album without coverart the coverart part is left blank maybe you could make the function that is shows any default picture?
And were is the white box left from the text Select Music source for? It's just a white box and it has no function or is it?
 
Regards, Joep
 
Op maandag 11 februari 2013 23:46:31 UTC+1 schreef Jarrod Bell het volgende:

posty

unread,
Feb 12, 2013, 5:30:58 AM2/12/13
to comman...@googlegroups.com
Joep

Have not written search to do radio yet. Can look to add the local buttons back although you can get to the equivalent through the radio menus I believe. Will check as to why it is not showing default album art as the code is there to do it!! The white box does nothing. A hang over from the subpage I stole from the JRiver GUI. Have been focused on code rather than aesthetics mainly as I am useless at aesthetics.

Simon

Joep van den Aker

unread,
Feb 12, 2013, 6:24:50 AM2/12/13
to comman...@googlegroups.com
Thank you for the feedback.
And keep up the good work!



Op 12 feb. 2013 om 11:31 heeft posty <simon...@gmail.com> het
volgende geschreven:

> Joep
>
> Have not written search to do radio yet. Can look to add the local buttons back although you can get to the equivalent through the radio menus I believe. Will check as to why it is not showing default album art as the code is there to do it!! The white box does nothing. A hang over from the subpage I stole from the JRiver GUI. Have been focused on code rather than aesthetics mainly as I am useless at aesthetics.
>
> Simon
>

Joep van den Aker

unread,
Feb 12, 2013, 6:28:39 AM2/12/13
to comman...@googlegroups.com
Just got an Sonos update..
Now it supports a Sonos favorites button were you can add all your
favorite music, radio and playlists in one place.
More work on the todo list Simon :)

Op 12 feb. 2013 om 11:31 heeft posty <simon...@gmail.com> het
volgende geschreven:

> Joep
>
> Have not written search to do radio yet. Can look to add the local buttons back although you can get to the equivalent through the radio menus I believe. Will check as to why it is not showing default album art as the code is there to do it!! The white box does nothing. A hang over from the subpage I stole from the JRiver GUI. Have been focused on code rather than aesthetics mainly as I am useless at aesthetics.
>
> Simon
>

Chap Cory

unread,
Feb 12, 2013, 12:03:35 PM2/12/13
to comman...@googlegroups.com
Sonos Groups-
Does this logic work? (I only have one player/Room, so I can't realyl tell).
Chap Cory

Joep van den Aker

unread,
Feb 12, 2013, 12:38:07 PM2/12/13
to comman...@googlegroups.com
I'm not sure but i think it is :)
I only tested with one player also.

DevC

unread,
Feb 12, 2013, 2:06:18 PM2/12/13
to comman...@googlegroups.com
I'm travelling for work but will test this as soon as I can. Simon can you tell me what GUI changes there were or is it too complicated?

Thanks

posty

unread,
Feb 12, 2013, 2:15:26 PM2/12/13
to comman...@googlegroups.com
I have 8 Sonos boxes plus a sub and at least in my setup grouping works fine. The code to group and ungroup is easy. The most difficult bit is getting them into the right order in the GUI!!! Will have a look at the Sonos favourite button. If they have done this by using a new ContentDirectory identifier (e.g. The player queue is q:0 in a directory browse) then it will work easily. If not who knows.......

As regards changes to the GUI, where a few but best way to find out is to use a diff tool on the XML.

Simon

posty

unread,
Feb 12, 2013, 3:35:36 PM2/12/13
to comman...@googlegroups.com
Have added support for Sonos favourites.  Don't think I broke anything in doing so but you never know.....still a couple of bugettes around the queue handling although have changed some of the queue handling.  Main bugs appears to be around displaying the 'playing' arrow in the queue that can sometimes get confused (usually when you first enter a new zone and it has yet to receive a transport event.....).  Generally reselecting the player fixes it!

Let me know if the favourites works.  Obviously you can't add to the favourites in the app.  You have to do that in the Sonos controller although I dare say it should be relatively easy to do.....

Simon

DevC

unread,
Feb 28, 2013, 2:57:29 PM2/28/13
to comman...@googlegroups.com
I havent forgotten about this i really want to get it integrated into my project but I have literally been travelling for the last few weeks solidly for work, and because you did a lot of changes, i need to spend time integrating it again (which is fine, just time consuming), but i hope to get it running soon. Have you made any more changes since your last update?

Joep van den Aker

unread,
Mar 2, 2013, 1:39:05 AM3/2/13
to comman...@googlegroups.com
Hi Sonos - CF developers.

First of all thanks for sharing the Sonos project with us and for all the time you spend making this project.

Up till now it's working fine for me except the synchronisation between several devices used at the same time. Also in combination with the Sonos (desktop) controller.
Maybe someone can take a look at that part of the script?

Thanks in advance!

Joep
--

posty

unread,
Mar 2, 2013, 11:03:07 AM3/2/13
to comman...@googlegroups.com
Joep

Have no time at the moment to work on the module. Not sure why it would loose sync although it will loose sync after 3 hours. Have not yet bothered to right the code to refresh its notification registration (Sonos has a 360 minute maximum time that you can register to receive notifications from the players). What is not syncing? Queue info or the now playing info (different message types)? There does not seem to much community interest in supporting the module and I am a bit busy at the moment.

Simon

Joep van den Aker

unread,
Mar 5, 2013, 1:23:07 AM3/5/13
to comman...@googlegroups.com
Hi Simon,

Both are not syncing very well. When using multiple devices.

Best regards, Joep

Op 2 mrt. 2013 om 17:03 heeft posty <simon...@gmail.com> het
volgende geschreven:

> Joep
>
> Have no time at the moment to work on the module. Not sure why it would loose sync although it will loose sync after 3 hours. Have not yet bothered to right the code to refresh its notification registration (Sonos has a 360 minute maximum time that you can register to receive notifications from the players). What is not syncing? Queue info or the now playing info (different message types)? There does not seem to much community interest in supporting the module and I am a bit busy at the moment.
>
> Simon
>

posty

unread,
Mar 10, 2013, 6:06:08 AM3/10/13
to comman...@googlegroups.com
Have been away in Scotland for a long weekend of snow and walking (great place you should all go to sometime if you like amazing landscapes)! However of relevance to this forum is that has given me sometime to rearchitect some areas to make them more reliable, especially around the player code and discovery. Will post the work over the next few days to get feed back. If you find bugs, being as specific as you can about the conditions that they occur would be great. Thx

Simon

DevC

unread,
Mar 28, 2013, 8:34:52 AM3/28/13
to comman...@googlegroups.com
Hi Simon

I hope to spend some time focussing on commandfusion again this week and specifically testing sonos, but i see you say you were looking at rearchitecting it, did you get any further with that?

Barry Gordon

unread,
Mar 28, 2013, 9:56:05 AM3/28/13
to comman...@googlegroups.com

I am not a Sonos user but a user of LMS, Logitech Music Server, aka SqueezeServer/SqueezePlayer/....

 

When I was doing Pronto development I developed the equivalent of what you are doing for the CF iPad for the Pronto PRO and LMS. It was all in Javascript with great graphics and excellent reliability/capability. I sold about 400 copies worldwide for $29.95 per.

 

When I switched to the CF iPad I was going to port the system over to the iPad but found an already done app called SqueezePad which was as good as what I developed if not better for $10.  SqueezePad had a URL schema so switching to it from my CF iPad app was a single button press.  Getting back was a little harder since a return mechanism was not implemented. It took two button presses; one to get out of SqueezePad (it went to background with the music still playing) and one to bring back my CF iPad app which was in background.

 

The developer of the SqueezePad app recently contacted me as he is just putting his Sonos app into beta testing and asked me if I would want to join the test team. I had to decline as I do not own any Sonos gear so testing would be a real challenge.

 

He informed me that he has implemented a return mechanism which I am assuming requires the app being returned to, to have a URL schema. I suspect the return URL Schema is passed as  a parameter of the URL Schema which brings his app up. He also indicated that once it is fully working in the Sonos app, he will retrofit the SqueezePad app with the same capability.

 

Don't get me wrong. I am not advocating any cessation of the Sonos development; in fact if I had a Sonos system I would be right there with you. I just want to call the teams attention to what is out there (or soon to be).

 

Does the CF iViewer have a URL schema so it can be referenced and dynamically loaded?

--

Jarrod Bell

unread,
Mar 28, 2013, 10:18:38 AM3/28/13
to comman...@googlegroups.com


Regards,

Jarrod Bell
CommandFusion
www.commandfusion.com


leepfrog

unread,
Jan 1, 2014, 8:20:07 PM1/1/14
to comman...@googlegroups.com
Hello posty,

I found this thread via google and also found the github repo you contributed to.
I am currently working on a sonos controller and I see that you are using the sonos endpoints to retrieve search results/metadata from spotify (I assume like playlists etc.). This would be something I'd like to integrate too but I was unable to find any documentation regarding the SOAP format/parameters that are required. Also from what it seems the sonos web services do not publish any WSDL files and the sonos application itself only connects to those via HTTPS but cannot be forced through a proxy so I am currently stuck there.

Could you give me a hint how you managed to figure out the available SOAP calls/the required format?

Thanks!

Am Freitag, 4. Januar 2013 18:39:33 UTC+1 schrieb posty:
As part of working on the Sonos module for CF I am trying to get information from Spotify.  I am using the code below.  I get a response of Error 400 with an error of what I think is unrecognised SOAPACTION.  However if I cut and paste the exact same SOAPAction and SOAPBody into Fiddler with the same host/url etc and fire it directly at Sonos I get the expected response gzip encrypted.  Anyone see anything I am doing wrong?  I have removed the tag 'sessionID' in the code below so this will not work if you try and cut and paste into Fiddler as the sessionID is my Spotify account so would give anyone access to my account through Sonos if this probelm is solved! BTW this function worked previously although it would appear Sonos modified their Spotify handling in their latest release (this output is taken by looking at the Wireshark traffic in the new Sonos version)

Simon


    self.retrieveMusicFromSpotify = function (callback, DeviceID, DeviceProvider, SessionID, ItemID, StartingIndex, RequestedCount)  {
        var host = "http://spotify.west.sonos-ws-eu.com";
        var url = '/smapi';
        var SOAPAction = "http://www.sonos.com/Services/1.1#getMetadata";
        var SOAPBody = '<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Header><credentials xmlns="http://www.sonos.com/Services/1.1"><deviceId>00-0E-58-28-3B-D4:8</deviceId><deviceProvider>Sonos</deviceProvider><sessionId>removed</sessionId></credentials></s:Header><s:Body><getMetadata xmlns="http://www.sonos.com/Services/1.1"><id>root</id><index>0</index><count>100</count></getMetadata></s:Body></s:Envelope>';
        var url = host + url;
        CF.log("url is: " + url);
        CF.log("SOAPAction is : " + SOAPAction);
        CF.log("SOAP Body is: " + SOAPBody + "\r\n");
        CF.request( url, 'POST', {'SOAPAction': SOAPAction}, SOAPBody, function(status, headers, body) {
            if (status == 200) {
                //CF.log("Spotify response is: " + body)
                callback(  body )
            }
            else {
                CF.log('POST failed with status ' + status);
            }
        });
    }

Chap

unread,
Dec 23, 2016, 5:58:50 PM12/23/16
to CommandFusion Software
Thanks to constant Sonos code breaking updates,
in 2016 the 2013 module ain't workin.
Has everyone lost interest?
Sonos is now a half billion dollar company, and is swamping the AV industry here in the US, hurting Autonomics, Crestron, et al.
What this means to integrators (all 3000 of us), is  that its easier to sell TVs and Sonos for the rest of the audio..

It means no high margin amplifiers, speakers etc in every room. These are business issues that threaten  our survival.

I have three av integrators I do programming for, and they don't need me anymore.
Elegant C3 glide be shamed, can't do sonos?
Oh well, see yah.

Chap

Tony Chuah

unread,
Dec 24, 2016, 4:29:34 AM12/24/16
to CommandFusion Software
It's annoying when Sonos and HEOS can't do video well. It was always going to go this way. But now that Spotify Connect has been enabled in Sonos, the playing field has been levelled a bit. Still, can't beat the convenience of wireless. :(
Reply all
Reply to author
Forward
0 new messages