PDA

View Full Version : Client protocol (Back for more punishment)



ScottM
2011-11-17, 07:26
This is somewhere between a rant and a question. I'm looking for complete and in-depth protocol descriptions of what happens between the client and the server, for the newer forms of Squeezeboxen. Does it exist?

Here's the backstory. I have 3 Squeezebox classics. I like them, but they aren't going to last forever and sooner or later I will have to buy newer forms of squeezeboxen. I've written my own server for them - the reasons are complicated, but the upshot is that I needed a bunch of behaviours and features that weren't available in Logitech's offering. The server is nothing like Logitech's (no web interface, a different CLI *that's never going to change out from under me*, vastly different abilities). I use it in my home automation - my squeezeboxes talk and flash at me if the doorbell rings, if someone I like calls me, if severe weather is coming, if it's time to get up, if an event on my calendar is coming up, and if the house is flooding. Oh, and they also play music on demand. :-)

Here's the deal, though. It took months to write working code to talk to a Squeezebox Classic at firmware rev 81. Online documentation was incomplete to put it very politely. I spent hours in wireshark, asking questions around this forum, and working around bugs. Nothing I'm going to go through again.

So I suppose I'm asking if Logitech is ever going to get serious about publishing ***complete*** protocol specs for the various squeezeboxen hardware. (Or if they did, and I missed it, where is it?) If the answer is "no", fine - maybe my next project will be to build my own version of a squeezebox, and abandon Squeezebox entirely. But if the answer is "yes", Logitech can probably count on on a few more sales out of me - and possibly, if I commercialize my server, some extra sales out of home automation enthusiasts.

Anyone got any insight into this question? Yes, I know I can download the Logitech server and spent months reading Perl. I've been down that road and it leaves a lot unanswered, not to mention being much more difficult than I'd like this to be. Specifications are better than code.

Thanks.

bluegaspode
2011-11-17, 07:47
The playback part (slimproto) is the same as with the older Squeezeboxes.

The connection on port 9000 is based on the comet/bayeux protocol - it is easily captured with wireshark, documentation can be found via Google.
As it's a custom implementation by Logitech don't expect everything from the documentation to work, but the basics are all there (which is good enough for everything)

I'm afraid the rest isn't documented as good (and changes from firmware version to firmware version of course).
Maybe best documented (but with high probability a bit outdated) is the documentation of the menu structure:
http://wiki.slimdevices.com/index.php/Home_Menu_Items_Versus_SlimbrowseItems

Then the other source is the CLI documentation of Squeezebox-Server.
All the commands documented there can just be sent via the comet-transport layer mentioned above.
Also the players heavily use the subsriptions (i.e. to get playlist updates or update of the now playing screen).

In the end I suggest just activating the network.cometd logs.
As everything is JSON it's easy to read and understand. Together with the CLI documentation one can get very very far.


What language is your server part written in?

pippin
2011-11-17, 09:50
One of the big gotchas of Logitech's Bayeux implementation is that unsubscribe us not supported and leads to funny results.
Instead, some subscriptions like displaystatus use a special kind of subscription to unsubscribe.

Also, don't expect things to stay as they are even between minor releases. It usually works but there can be changes. There's a reason why Squeezeboxes always update their firmware to match the server version.

nicolas75
2011-11-17, 11:09
What platform are you using for your own server ?
It seems there is more and more need for such a client protocol for those who want to get rid of SBS/LMS.

I recently looked deeper in MediaMonkey and it seems it does everything at least as good and sometimes much better than LMS, especially for basic use.

MediaMonkey can now behave as a server, and can be controlled with android smartphones, it can have good plugins.

If you start something to use squeezeboxes as client devices, and if it is possible to play them directly with servers like MediaMonkey, I guess a lot of people will bless you.

ScottM
2011-11-17, 21:38
My server is in C++, and runs on Windows. (I've also compiled and tested it on Linux; it's written to be portable). Before anyone gets too excited, it isn't anything like Logitech's server. It has no web interface. The CLI is very different. I never bothered to implement multiplayer sync, and the only device supported is Squeezebox classic at rev 81. It doesn't compute song duration. It doesn't support passworded internet music services - basic ICY only. And the only way to find songs is by navigating the directory structure you use for your songs - no database is involved. So it's up to you to store songs in a directory structure that you like.

It does have some nice advantages, though. It is very fast, very small (7M is typical; Logitech's STARTS at 83M), and "rescan" finishes in a few seconds (for collections of a few thousand songs). Playlists are fully integrated; you can specify any mix of playlists, directories or files in any command that deals with editing the current playlist. (This wasn't true in the last Logitech server I messed with, 6.5.4.) And playlists can contain directories and other playlists.

I can make the source available, but anyone using it would want to strip out the extensions I have for my home automation. It's decently commented, but learning the SB protocol from it is probably non-trivial (but likely easier than reading the perl for LSS). You'd also have to write your own software to speak its CLI - my control app is hopelessly tied to my house software and you don't want it.

nicolas75
2011-11-18, 04:32
I just tried MonkeySqueeze 2.0 with MediaMonkey 4 and LMS 7.7.0
http://forums.slimdevices.com/showthread.php?t=89046

It is probably the best news I had in 4 years as far as squeezeboxes softwares are concerned.

Since you are on Windows, you should have a look.
MediaMonkey is really excellent piece of software, can behave as a server, can be controlled with a smartphone, and you can find or develop a bunch of plugins (with serious documentation ...)

It could be much easier to develop a MediaMonkey plugin for your needs, than writing your own server.

ScottM
2011-11-20, 09:07
...
It could be much easier to develop a MediaMonkey plugin for your needs, than writing your own server.

It probably would have been... but I already have my own server, and it's got all the characteristics I want, except support for newer devices.

To be clear, if a solution involves a Logitech server, I don't want to use that solution. I'm not interested in easy solutions, I'm interested in high-reliably solutions. The Logitech servers have never quite achieved that (again, to be fair, I haven't used their latest; but many previous versions had such horrendous problems, and changed the CLI so many times, that I would not consider going back.)