Songs with Sam is live
Whats it all about
I’ve wanted to make thins project for awhile now so its exciting for me to have something live. Songs with Sam is a simple pretty simple concept but with a twist. I setup a Raspberry Pi that can stream and play songs from Spotify. Rather than select songs locally on the Pi I built a web interface that allows anyone to search for tracks and send them to the Pi to be played. The current state of the Pi is kept up-to-date in real time using socket events so whatever the site says is happening is what the Pi is currently doing.
Getting things done
This project was partly an exercise in restraint. With almost all of my recent side projects I’ve gotten carried away with ideas and moved on before finishing. Often half way though a personal project I decide it has to have feature X and begin work on it imediently. This leads to never getting to the point where I can get a project live or release the code. I wanted Songs with Sam to be diffrent, my aim was to start and finish over easter and although it took tiny bit longer im glad I held back on lots of the ideas I had along the way. To name just a few - A queing feature, improved spotify search, dynamic favorites list, dynamic playlist, better error handling and many more.
Node Spotify Web
This ideas was sparked mid 2013 when I first came across the node-spotify-web repo on Github. This collection of code implements the “Spotify Web WebSocket protocol” used for http://play.spotify.com and in theory it’s possible to replicate any functionality that is in use there. The API documentation is limited but look at the examples and you’ll see it’s relatively straight forward to get things up and running.
This repo was the first that I submitted an issue too and 8 months later received my first merged open source pull request. I was able to add functionality to solve my own issue, getting a users Starred Playlist and getting a list of public playlists for a given user which had both previously not been implemented.
I’ve released the source code on Github for anybody to take a look how everything works. If you’re interested in setting your own project up the repo should be everything you need. As I said before there are a lot of possibility for expansion on this project so feel free to throw pull request at it, if thats your thing.
If you like this project let me know on Twitter. Shout out to adammw cheers for all the work you do on the node-spotify-web repo would never have got this project off the ground without your work.