Spotify player for distributed Raspberry Pi devices.
Assumption: You are using a Raspberry Pi 2 running the latest Raspbian OS (Debian). This is my setup & it works. Anything else you're on your own.
git clone https://github.com/drb/spotipi.git <target_dir>
sudo apt-get install curl
sudo curl -sL https://deb.nodesource.com/setup | sudo bash -
apt-get install -y nodejs
apt-get install -y build-essential
sudo apt-get install libasound2-dev
This loads all the prerequisites from
sudo npm install
Once the code initializes it will output a path you can connect to with a mobile device or browser. The default port is 3000.
There are a few ways to do this - forever is an NPM module that will spawn an instance of the server in the background and restart it when the process inevitably crashes.
sudo npm install -g forever
Note: If you started the process earlier using
node spotipi.js, kill it now; otherwise you won't be able to start it using forever.
forever start spotipi.js
forever list - this will output the process - take a note of the pid's index that is listed between [parens] i.e.  spotipi.js
forever stop <pid_index>