Reversing Spotify Connect Protocol
#1
Just thought I'd put it out there that we're trying to implement an open source version of the Spotify Connect protocol, which allows you to stream to hardware devices. Figured XBMC would be one of the projects that would benefit from such an addition, in the form of an addon or the like, but the main reason I'm here is that we're looking for anyone who knows a bit about reverse engineering or anything else that might help the project out, and if you have some spare time and want to contribute, for the benefit of of open source media boxes everywhere Wink

Anyways, thanks for reading.

The repo for work so far, and links to related stuff can be found here: https://github.com/sashahilton00/spotify...-resources
And if you're feeling talkative, the repo chatroom is here: https://gitter.im/sashahilton00/spotify-...-resources

Any and all contributions welcome. See u soon Smile
Reply
#2
Spotify Connect Protocol, is the purpose of that protocol similar to that of the AirPlay / AirTunes protocols or is it more like the DIAL protocol used by Chromecast and Google TV?

http://en.wikipedia.org/wiki/AirPlay
http://en.wikipedia.org/wiki/Discovery_and_Launch
http://electronics.howstuffworks.com/chromecast2.htm

I mean is it more like AirPlay / AirTunes where the app on your smartphone that stream the music from the internet and wirelessly transfers it to the receiver via Spotify Connect Protocol?

or is it is more like the DIAL (DIscovery And Launch) protocol where the app of your phone only acts and a remote and launcher for the receiver that stream the music from the internet?

EDIT: Only found some info here http://divideoverflow.com/2014/08/revers...y-connect/
Reply
#3
It is pretty similar to the DIAL protocol that chromecast uses; the Spotify client passed playback control commands and music data requests, which in turn is retrieved from Spotify servers by the receiver.
Reply
#4
Reading this blog post it sounds as if the Spotify Connect protocol still using lots of code for authentication, encryption and communication with Spotify servers identical or just slightly different to despotify or libopenspotify.

http://divideoverflow.com/2015/02/update...reversing/

So wondering if you will you then be implementing this a new separate open source library for only this that will only support the Spotify Connect protocol? Or will you be integrating it into code from an existing reverse engineering project like libopenspotify, despotify, or respotify, which were more or less all designed to work as a 1:1 drop-in binary replacement for the official libspotify?

https://gitorious.org/libopenspotify/

http://despotify.sourceforge.net

https://github.com/Hexxeh/spotify-websocket-api

Regardless I'm guessing that users still always need a paid premium account for Spotify to stream content, right?
Reply
#5
(2015-03-20, 11:42)RockerC Wrote: Reading this blog post it sounds as if the Spotify Connect protocol still using lots of code for authentication, encryption and communication with Spotify servers identical or just slightly different to despotify or libopenspotify.

http://divideoverflow.com/2015/02/update...reversing/

So wondering if you will you then be implementing this a new separate open source library for only this that will only support the Spotify Connect protocol? Or will you be integrating it into code from an existing reverse engineering project like libopenspotify, despotify, or respotify, which were more or less all designed to work as a 1:1 drop-in binary replacement for the official libspotify?

https://gitorious.org/libopenspotify/

http://despotify.sourceforge.net

https://github.com/Hexxeh/spotify-websocket-api

Regardless I'm guessing that users still always need a paid premium account for Spotify to stream content, right?

Sorry for taking a while to reply, have been a little busy. We have looked at the various clients, but all are either way behind the current Spotify in terms of functionality, or would require a lot of work to modify. We were hoping to build something on top of the libspotify library, but it doesn't really have the necessary hooks to make it viable without having to write a huge amount of code just to make it work properly. Also, it's depreciated. We've decided on a new library from scratch. So far all of the authentication, encryption, messaging protocols and other proprietary crap has been reversed, and we have a rudimentary PoC at the moment, with the first iteration of the library currently under development. Development is a little slow at the moment, as people arebusy with exams/jobs, but development should pick up again as Summer approaches. Will try and keep you posted. In the meantime, the chat is the best place to reach the team, or if you want to view the library under development: https://github.com/plietar/spotify-conne.../librespot
Reply
#6
hi,

I've been checking the github chatroom periodically and it looks like you've made good progress. Is it at a point where you might bundle up a release or what else needs to be implemented etc?

I really appreciate your efforts!
Reply
#7
That's a good question. I will look into what we consider to be a base feature set for connect, then have a look at what has been implemented. Once the base feature set has been implemented, we can push 0.0.1 Smile
Reply
#8
Hi,

I see that you didn't get any replies on gitter - Does that mean it's good to go? Smile
Reply
#9
Great project here - It's definitely a good solution for Spotify users to connect/stream to a Kodi client as a player.
Reply
#10
Is there any quick and easy way to test/trial this. I'd love to run it on my OpenElec RaspberryPi. (The one that is in use as a music player right now.. Airplay and via Yatze for music files).
I looked at the github instructions https://github.com/plietar/librespot - but could be too much time right now.. (unless I'm missing something and should be building it all on my ubuntu laptop, then moving a binary to the OpenElec Pi.).. Which makes me think, if it's just building a binary for a Pi.. does someone have one I could use :-)
Really keen to see this in use here, a great alternative to play music to.
Reply
#11
This looks very promising! I look forward to (hopfully) a 1 click kodi addon install sometime in the future. I imagine it would be quite popular.
Reply
#12
OK, trying the SCPlayer.jar route.. (now I've sorted out my spotify account, unconnected it with FB).
This is on RPi1, openelec 6.0.0. but it's now crashing.
http://pastebin.com/jppaW9JA

This actually would be great to add into core Kodi if possible.. should just be a service like AirPlay IMHO.
Reply
#13
Wanted to update for anyone trying this: on RPi2, Following the instructions here, this works very well, can just run in background on my OpenElec 6.0 RPi2. - Shows up nicely as a Spotify play device. I'm running standalone as really only interested in being able to play to it from one of my smart phones or tablet.

Installing SCPlayer is straightforward.. https://github.com/crsmoro/scplayer/tree/master

Download the latest jdk from the link. You need jdk-8u65-linux-arm64-vfp-hflt.tar.gz
Gunzip it on your laptop/PC and then sftp it onto your Pi
ssh onto your Pi and "tar xvf jdk-8u65-linux-arm64-vfp-hflt"
This will create you a jdk1.8.0_65 directory
"wget https://github.com/crsmoro/scplayer/raw/...Player.jar"
"wget https://github.com/sashahilton00/spotify..._shared.so"
You also need to create the API Key.. follow the instructions and then either wget it or sftp onto your Pi.
On OpenElec, also need to run this command: "echo snd_bcm2835 >> /storage/.config/modules-load.d/audio.conf"
then type "reboot" and once available, ssh in again

Then run ./jdk1.8.0_65/bin/java -jar SCPlayer.jar - then go look at your Pi's Address:4000
That should let you log in and test: It should show up on your other Spotify devices/Mac/PC etc and you should be able to play to it.
once you've tested that. remove the file credentials.json (maybe don't need to do this always) and then run in silent mode.
./jdk1.8.0_65/bin/java -Dusername=[spotifyusername] -Dpassword=[spotifypassword] -DplayerName=[name for the player] -Dstandalone=true &

That will run it in background and you then should be able to play to it from your other Spotify devices.

Would be great as a proper add-on, or maybe even part of core Kodi like AirPlay.
Reply
#14
whats the difference to airplay? can someone please explain me? with airplay you can also stream spotify to kodi.
Reply
#15
I think 2 things.
1) Spotify Connect actually streams direct from spotify, once directed by the other device (I'm not sure of this, though, it just looks like that)
2) AirPlay is iOS only..
Reply

Logout Mark Read Team Forum Stats Members Help
Reversing Spotify Connect Protocol0