[HowTo] Setup a spotify-connect-web-server on a Raspberry Pi with OSMC

Here is a more to-the-point how to, from a linux computer (updated for the latest version of the chroot and to fix a small mistake):

Connect and download the script:
ssh osmc@osmc.lan
mkdir extras && cd extras
curl -OL https://github.com/Fornoth/spotify-connect-web/releases/download/0.0.3-alpha/spotify-connect-web.sh
chmod u+x spotify-connect-web.sh
As I’d rather have the chroot live in ~/extras, edit spotify-connect-web.sh to change its DIR variable:
nano spotify-connect-web.sh, find DIR= and change from DIR=~/spotify-connect-web-chrootto DIR=~/extras/spotify-connect-web-chroot. ctrl+x to close, Y to confirm changes.
then actually install it:
./spotify-connect-web.sh install

From your computer, download your binary spotify app key from the spotify website, then send it over using scp:
scp ~/Downloads/spotify_appkey.key osmc@capybara.lan:/home/osmc/

And back on the osmc box, move it to where it should go:
sudo mv ~/spotify_appkey.key ~/extras/spotify-connect-web-chroot/usr/src/app

Test it out:
./spotify-connect-web.sh --username $YOURSPOTIFYUSERNAME --password $YOURSPOTIFYPASSWORD --bitrate 320 --name $NAME_OF_YOUR_OSMC_COMPUTER_AS_WILL_APPEAR_IN_THE_SPOTIFY_APPS
ctrl+C to stop it

Then sudo nano /etc/systemd/system/spotify-connect-web.service
copy paste the systemd unit script graciously provided by @zatarra (slightly modified to suit my favoured path):

[Unit]
Description=Spotify Connect
After=network-online.target
[Service]
Type=idle
User=osmc
ExecStartPre=/bin/sleep 25
ExecStart=/home/osmc/extras/spotify-connect-web.sh --username $YOURUSERNAME --password $YOURPASSWORD --bitrate 320 --name $NAME_OF_YOUR_OSMC_COMPUTER_AS_WILL_APPEAR_IN_THE_SPOTIFY_APPS
Restart=always
RestartSec=10
StartLimitInterval=30
StartLimitBurst=20
[Install]
WantedBy=multi-user.target

ctrl+X to exit, Y (yes) to confirm and save
make the systemd unit executable:
sudo chmod a+u /etc/systemd/system/spotify-connect-web.service
sudo systemctl daemon-reload
sudo systemctl enable spotify-connect-web.service
sudo systemctl start spotify-connect-web.service

This should be a bit faster for those used to the linux commandline :slight_smile:

1 Like