No description or website provided.
Python C HTML JavaScript Shell
Latest commit 9a17414 Dec 12, 2016 @Fornoth committed on GitHub Merge pull request #80 from cadavre/patch-1
Update pyalsaaudio dependency to 0.8

Spotify Connect Web

This is based off of the example code from

Quickstart using a packaged release

This is a version of spotify-connect-web with all dependencies bundled (about 7MB compressed, 13MB extracted)
For armv7+ (Rpi 2, Rpi 3, etc, but not Rpi 1/Rpi Zero) devices only for now

Grab the latest release from Releases

Installation instructions (example):

tar zxvf spotify-connect-web_0.0.3-alpha.tar.gz

A spotify-connect-web directory will be created, and you'll need to put your spotify_appkey.key in that directory


Just run ./spotify-connect-web in the extracted directory
Supports the same options as the regular version

Quickstart using a pre-built chroot

Grab the latest release from Releases

If you just want to get running, you can use a pre-built chroot with the latest version installed.

Installation instructions (example):

curl -O curl -OL
chmod u+x
# Download the current chroot (~ 180 MB)
./ install
# Copy your `spotify_appkey.key` into the app directory. (See below for information on how to get that file.)
sudo cp spotify_appkey.key spotify-connect-web-chroot/usr/src/app/
# Run using normal cmdline options
./ --username 12345678 --password xyz123 --bitrate 320

(Btw, the chroot is built nightly from master using Docker on a C1. Manually built for now. See the Makefile for details.)

Quickstart with Docker

(You will have to use sudo if not logged in as root.)

  • Get Docker running on your machine. (See this preliminary documentation for advice.)
  • Get your spotify_appkey.key and put it into the base directory. (See below for details.)
  • Build the container via docker build -t spotify-connect-web .
  • Run it via ~/run-with-docker.

Installation from source

Requires development packages for Python, FFI, and Alsa

  • For Debian/Ubuntu: apt-get install python-dev libffi-dev libasound2-dev

To install the other requirements: pip install -r requirements.txt


usage: [-h] [--device DEVICE | --playback_device PLAYBACK_DEVICE]
               [--mixer_device_index MIXER_DEVICE_INDEX] [--mixer MIXER]
               [--dbrange DBRANGE] [--cors CORS] [--debug] [--key KEY]
               [--username USERNAME] [--password PASSWORD] [--name NAME]
               [--bitrate {90,160,320}] [--credentials CREDENTIALS]

Web interface for Spotify Connect

optional arguments:
  -h, --help            show this help message and exit
  --device DEVICE, -D DEVICE
                        alsa output device (deprecated, use --playback_device)
                        alsa output device (get name from aplay -L)
  --mixer_device_index MIXER_DEVICE_INDEX
                        alsa card index of the mixer device
  --mixer MIXER, -m MIXER
                        alsa mixer name for volume control
  --dbrange DBRANGE, -r DBRANGE
                        alsa mixer volume range in Db
  --lastfm_username LASTFM_USERNAME
                        your username
  --lastfm_password LASTFM_PASSWORD
                        your password
  --lastfm_api_key LASTFM_API_KEY
                        your API key
  --lastfm_api_secret LASTFM_API_SECRET
                        your API secret
  --lastfm_credentials LASTFM_CREDENTIALS
                        file to load credentials from
  --cors CORS           enable CORS support for this host (for the web api).
                        Must be in the format <protocol>://<hostname>:<port>.
                        Port can be excluded if its 80 (http) or 443 (https).
                        Can be specified multiple times
  --debug, -d           enable libspotify_embedded/flask debug output
  --key KEY, -k KEY     path to spotify_appkey.key (can be obtained from
  --username USERNAME, -u USERNAME
                        your spotify username
  --password PASSWORD, -p PASSWORD
                        your spotify password
  --name NAME, -n NAME  name that shows up in the spotify client
  --bitrate {90,160,320}, -b {90,160,320}
                        Sets bitrate of audio stream (may not actually work)
                        File to load and save credentials from/to must be in the same directory as the python scripts.
Also requires a spotify premium account, and the spotify_appkey.key (the binary version) file needs to be obtained from , and needs to placed in the python scripts directory, or have the path specified with the -k parameter

Launching from source

  • Running without debug output LD_LIBRARY_PATH=$PWD python
  • Running with debug output LD_LIBRARY_PATH=$PWD python -d
  • Run with only flask debug output (flask debug output allows you to see the python exceptions that are thrown) DEBUG=true LD_LIBRARY_PATH=$PWD python
  • Can also be run without the web server (Requires username and password to be passed in as parameters) LD_LIBRARY_PATH=$PWD python -u username -p password


Generated with cpp spotify.h > spotify.processed.h && sed -i 's/__extension__//g' spotify.processed.h spotify.h was taken from from

Web server

Server runs on port 4000

Logging in

After logging in successfully, a blob is sent by Spotify and saved to disk (to credentials.json by default), and is use to login automatically on next startup.


There's a login button on the webpage to enter a username and password, or you can pass the --username and --password arguments

If you want to enable scrobbling, you should first obtain API key at You can pass your --lastfm_username, --lastfm_password, --lastfm_api_key and --lastfm_api_secret on the command line. You can also use lastfm_credentials.json and pass --lastfm_credentials lastfm_credentials.json to the command line. You can find an example of the file format in lastfm_credentials.json.dist. You need to explicitly pass the credentials file, otherwise the module will not launch.

Passwordless/Multiuser (Zeroconf/Avahi)

Zeroconf (Avahi) login can be used after executing the command avahi-publish-service TestConnect _spotify-connect._tcp 4000 VERSION=1.0 CPath=/login/_zeroconf (avahi-publish-service is in the avahi-utils package).


You can file an issue or come to the Gitter chat