Sonos with node.js, my attempt!



Show first post
This topic has been closed for further comments. You can use the search bar to find a similar topic, or create a new one by clicking Create Topic at the top of the page.

397 replies

Userlevel 4
Badge +14
Just a Observation of the Index page not tablet friendly. Fav cannot be selected by touch group can not be moved etc. Aslo will you be updating the other lib to reflect the new que changes. Many thanks again...

I will not make this layout tablet friendly, mainly because the layout itself isn't tablet friendly, nor the controls. The plan is to implement alternate layouts for mobile and tablet (/m, /t) with different behaviors. Hopefully they can be a bit more user friendly than the current mobile apps (which I think is a pain to use). I have already made a custom /dashboard version: http://upload.grabbarna.se/files/IMG_20131125_105225.jpg which runs on one of the screens here at work. It took me about 30 minutes to complete, because all of the backend is already in place. Most of the time was just to implement client-side interaction with Spotify to get high resolution images of the tracks.

And the queue changes doesn't affect the http-api atm. I'm not sure if a "seek" instruction should switch back to the queue and start playing it through a http API to be honest?
Userlevel 2
Badge +2
Just a Observation of the Index page not tablet friendly. Fav cannot be selected by touch group can not be moved etc. Aslo will you be updating the other lib to reflect the new que changes. Many thanks again...
Userlevel 4
Badge +14

npm WARN package.json sonos-web-controller@0.5.4 No repository field.
(next line is this)


Is it that one you are wondering about? Or the scrambled output from the sax install?
Confirmed here too....

Both the rdio, and slacker streams are starting from the websonos favourites list.

Memory use seems to be 35->45 meg here.... over extended runs of 24->48 hours.

Just an FYI though.... I've seen this bug when forcing the sonos-discovery to reinstall after deleting the directory. No impact other then seeing it...

code:

node_modules# npm install sonos-discovery
npm WARN package.json sonos-web-controller@0.5.4 No repository field.
(next line is this)
npm http GET https://registry.npmjs.org/sax
(skipping some normal output)
.....
npm http 304 https://registry.npmjs.org/html-entities
npm http 200 https://registry.npmjs.org/xml2js
sonos-discovery@0.7.5 sonos-discovery
...
└── sax@0.5.5


Well done sir. This is definitely coming together....
Userlevel 2
Badge +2
Looking very good ! Que seems to function well and the server sees no errors radio to local content and back 😉 will bang on it some more thank you...
Userlevel 4
Badge +14
Thank you everyone for your feedback, I think I have resolved some of the radio problems now.

Make sure that you are using v 0.7.5 of the sonos-discovery module, and try again.

Regarding the notification.log and positioninfo.log, they are debuglogs that I have used, and will be removed when I feel like I don't need them anymore. You will have to live with them for a while longer 🙂
Captured on the windows xp netbook.... (it was easier)...

PM'd you J with the answer for the SetAvTransport.

If you need more from the stream let me know. I'll probably try to grab a slacker one tomorrow....
Userlevel 4
Badge +14
I think I know what's going on. Just out of curiosity steelrat, did those favorite use to work?

I'll try and find a permanent fix for the radios when I get the time, now I have some more references to work with.
So I updated the version.... to the latest git from 5:00pm EST ....

When I go to use the favourites to start a stream out of rdio.... I find that it just sits there. No change. If I have the desktop controller open and visible, I see that it "flashes" for a second, but no change.

If I have one playing started through the desktop controller, I can start or resume the stream without issue.

I grabbed the pm2-service-out.log I'll pm it to you, since I don't have time right now to strip out the macs.....

Slacker seems to suffer the same issue.

Tuned in, or even the jazzradio/di.fm premium seem to work OK though.
Userlevel 2
Badge +2
Yes got it it

It says Queue Not in use....

Sorry did not understand 😃
Step away from the thread for a few days.... wow... looks like I miss all kinds of changes...

So just for reference J.....

code:

websonos │ 0 │ fork │ 8405 │ online │ │ 0 │ 47h │ 46.367 MB │ /root/.pm2/logs/websonos-err.log

-rw-r--r-- 1 root root 0 Nov 11 20:48 websonos-err.log
-rw-r--r-- 1 root root 318495 Nov 22 16:55 websonos-out.log


This is interesting though:
./node-sonos-web-controller/
-rw-r--r-- 1 root root 22371372 Nov 22 16:55 notification.log


Been running on the linux vm (ubuntu 12.10) for 47 hours now straight. With average use around here.... Got only 46 megs in use right at this moment.... The log file.... isn't bad size anymore either.

Great job.... thus far. I think I'm on 0.4.x still since I haven't grabbed the git code since monday or tuesday.

I'll pull in the latest now, and see how it does.

BTW, since you suggested it... I've been finding that even running an npm update for the sonos-discovery manually, I still have needed to delete the directory and npm install.... Most of the other stuff, like socket.io and static don't need the extra work.
Userlevel 4
Badge +14
Yeah, I saw that too, but I think that's because the windows console doesn't word wrap correctly.

Robertboca, I want you to test what I said with the official app, not my stuff.
Perhaps I'm jumping into a sea where I don't know what I am doing, but the space between "r o" in "object.item.audioItem.audioBr oadcast" seems out of place. Perhaps this is just an artifact of a message text capture.
Userlevel 2
Badge +2
got it ...sorry

no it does not .......
test steps
added something to q
entered localhost:5005/office/favorite/carlos

played fine then

tried to change to new fav and failed

hope that helps....
Userlevel 4
Badge +14
Nothing is playing all q empty

That's not what I asked 🙂 I want you to do this:

Add a queue to a player (local tracks or something).

Play a Pandora favorite, does it say (queue not in use)?
Userlevel 2
Badge +2
Nothing is playing all q empty
Userlevel 4
Badge +14
If you have a player that is currently playing a queue, and you start playing that pandora radio, will the queue remain on that player and say (not in use)?
Userlevel 4
Badge +14
How nice would it be if this code (once completed) ultimately resided in the Sonos bridge or one of the players themselves. A fully native web based controller that would be good. No issues of operating systems, client apps, etc..

Just a thought.


I don't see that happening though, I'm afraid. I saw that someone suggested this over at ask.sonos.com, https://ask.sonos.com/sonos/topics/bridge_web_server_to_control_the_system_extend_the_memory_limit

But in my experience, this is not something that would benefit the majority of the users, which means that it isn't likely to be produced.

Either way, a raspberry pi is very inexpensive (even cheaper than a bridge), and it would even be possible to make a preinstalled image for it (with node and stuff already installed), to flash on an SD-card. And if I had a 3D printer I would build a small Sonos-like casing for it as well 🙂
Userlevel 2
How nice would it be if this code (once completed) ultimately resided in the Sonos bridge or one of the players themselves. A fully native web based controller that would be good. No issues of operating systems, client apps, etc..

Just a thought.
Userlevel 4
Badge +14
Does it support radio Fav Like Pandora etc or am I doing something wrong?

Ordered a raspberry pi to run this very cool it really will make a amazing package for sonos integration.


Hi, it is supposed to support Pandora, however I have no way of testing it (we don't have pandora here in Sweden). If you are using the http-api, you could send me the /favorites output so that I can see what the pandora items looks like.

Regarding the raspberry, I tested it with the B version (the one with 512 MB RAM and ethernet). I suggest you buy that one, at least for the ethernet port (you can just jack it into any ZonePlayer).
Userlevel 4
Badge +14
Okay, I added some checks when trying to parse the XML, seems like it act up occasionally, I don't know why yet.

And seems like I had forgotten to commit the empty queue fixes, my bad. They should be up in the git repo now. Make sure that you are using v 0.7.4 of the sonos-discovery module (check packages.json in the module folder), if not, delete it and run npm install again.
Userlevel 2
Badge +2
Favorites in the html server....

Does it support radio Fav Like Pandora etc or am I doing something wrong?

Ordered a raspberry pi to run this very cool it really will make a amazing package for sonos integration.

Thank You Robert
Userlevel 2
Unfortunately with the latest update, the empty queue error has returned.
Userlevel 4
Badge +14
I changed the port behavior for discovery and notifcations to support multiple instances, which means that:

for ssdp it will randomize a port between 1902 and 2702 (it was impossible in node to identify occupied ports). For notification it will try and bind to port 3500 (like the android client), but if that one is taken it will try 3501, 3502 etc. This is usually not a problem for you, unless you have a segmented network and need to handle firewall rules.

I also added support for settings.json for sonos-web-controller, to let you configure listening port (for web GUI) and cache dir without changing the source. That way it will live through an update.

I have also verified that this runs on the raspberry pi. It has to work for it a bit, but it's not overwhelming.
Userlevel 2
Badge +2
Yes it would be very cool to have both running as I am trying to integrate it with my home automation system and both are just what I have been looking for .......:D Thank You