Introduction: Spotify Connect

Picture of Spotify Connect

Hello,

How to connect your favorite speakers to spotify with the official application: Spotify Connect.

Step 1: Wifi on Your Raspberry

Picture of Wifi on Your Raspberry

I use a USB WIFI key on my Raspberry pi A+ (under raspbian) to connect the system on my domestical network.

The reference of the usb key use in the tutorial is a TP-LINK TL-WN725N.

To connect the system you have to change te file /etc/network/interfaces:

# interfaces(5) file used by ifup(8) and ifdown(8)
# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d<br>auto lo
iface lo inet loopback
#iface eth0 inet manual # put # to accelerate the boot
#allow-hotplug wlan0
#iface wlan0 inet manual
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
#allow-hotplug wlan1
#iface wlan1 inet manual
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "*****" # put your ESSID
wpa-psk "339***************3C1" #Put your wifi password

Step 2: Install Spotify Connect

Go to /home/pi.

Download the file develop by Fornoth:

curl -O <a href="http://spotify-connect-web.s3-website.eu-central-1.amazonaws.com/spotify-connect-web.sh"> http://spotify-connect-web.s3-website.eu-central-</a>1.amazonaws.com/spotify-connect-web.sh

Make it executable:

chmod u+x spotify-connect-web.sh

Launch the installation of the pre-build Spotify-connect:

./spotify-connect-web.sh install

The script is download into the file "spotify-connect-web-chroot".

Step 3: Spotify Appkey

Picture of Spotify Appkey

You need a spotify premium account.

You need to download your "spotify_appkey.key" on this website:

https://devaccount.spotify.com/my-account/keys/

Put yout ID/password and get your key "spotify_appkey.key"

Is not possible to gat your key with the raspberry (no web browser), so you need to get it with yout laptop and send it to the raspberry with SFTP protocol (filezilla for example) to the adress:

/home/pi/spotify-connect-web-chroot/usr/src/app

Step 4: System Launching

Picture of System Launching

To test the environement launch the command with your spotify's ID/password. Optionnal you can choos the name of connection.

./spotify-connect-web.sh --username ID --password password --bitrate 320 --name Rpi

For automatical lunch creat a file launch in the repetory /home/pi. Put yout Spotify's ID/password.

#!/bin/bash

set -e

DIR=/home/pi/spotify-connect-web-chroot
trap "sudo umount $DIR/dev $DIR/proc" EXIT
sudo mount --bind /dev $DIR/dev
sudo mount -t proc proc $DIR/proc/
sudo cp /etc/resolv.conf $DIR/etc/
sudo chroot $DIR /bin/bash -c "cd /usr/src/app && python main.py --username Identifiant --password MotDePasseCompte --bitrate 320 --name Rpi"

Create the file launchspotify in the repetory /etc/init.d/:

#!/bin/sh

sleep 5

sudo sh /home/pi/launch &

Make it executable

sudo chmod 755 /etc/init.d/launchspotify.sh

Finaly launch the last command to launch spotify connect at boot:

update-rc.d launchspotify.sh defaults

Comments

About This Instructable

2,955views

9favorites

License:

More by yopcoo:Spotify Connect
Add instructable to: