Raspberry Pi Spotify Player

I built a Spotify-Player based on a Raspberry Pi 3 and Tizonia. It has 5 buttons to switch between different playlists and another button to skip to the next song in a playlist.

The Raspberry Pi is mounted with the help of what I built over here. There is not too much space left but everything fits into the compartment if you just squeeze it firmly enough.

When the device is powered on it connects to the internet, randomly selects one of the playlists and starts playing in shuffle-mode. Playlists are read from an xml-file which is stored on GitHub. This allows me to change the playlists from remote. The player reboots every night at 4 o’clock and automatically checks for updates. The Spotify-part is handled via Tizonia.

The handling of the buttons, sanity checks, etc is done in a rather simple python-script. The script uses the D-Bus interface to connect to the Tizonia player. Based on the file ‘updateID’ (see repo) I can trigger an update of the script itself. Everything can be found in this Github repo.

[Update] In order for Tizonia to work without consuming ridiculous amounts of CPU it is necessary to autologon into an X-Window (configure that in raspi-config). If you want to run the system without the need for a monitor add the line

export DISPLAY=”:0″

at the end of the file .bashrc. I figured out that things become somewhat sketchy when running interactively from the command line (DBUS not reacting, high amount of CPU usage, …). That’s why the script ‘tizonia.py’ (see repo) starts a dedicated lxterminal in order to run Tizonia:

subprocess.call(‘lxterminal -e tizonia –spotify-playlist-id ‘ + lst_playlist[playlistID] + ‘ -s &’, cwd=’/home/pi/’, shell=True)

Please also enable the DBus interface in Tizonia’s config file: mpris-enabled = true

[/Update]

Tagged , , , .Speichere in deinen Favoriten diesen permalink.

Eine Antwort zu Raspberry Pi Spotify Player

  1. Mathis sagt:

    Hi Andy, ein gutes neues Jahr! Finde ich super das Projekt und will es nachbauen. Aber über ein Problem stolpere ich, das ich auf Github geschildert habe. Würde mich sehr freuen, wenn Du mal einen Bick darüber werfen könntest.
    Viele Grüße,
    Mathis

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert