All code can be found on GitHub
In these days of lockdown, like many of you, I am working at home. While working I listen to Spotify on a set of Audioengine speakers connected to my local machine and log in to my work machine using Citrix. Typically I control the music from my phone or by minimising the Citrix session on my machine. This is fine for controlling the music, but I like to see what track is actually playing without interrupting my work, so I have a Raspberry Pi with the official touch screen tracking what I am listening to.
The code is written in Python using Flask and SocketIO. The Flask app is checking my Spotify account and publishing to a browser session that has automatically opened full screen on the Pi. The screen shows the track playing, the artist, the album and the playlist.
The code uses the excellent spotipy library. Many thanks to the developers. I used the instructions here to make the Pi boot into the Chromium browser full screen and connect to the website. The website is running as a service on the same Pi under systemctl.
As the browser is running full screen there is no way easily to power down the Pi without simply unplugging it. This is obviously undesirable so double tapping on the screen will initiate a close down.
To enable the app to connect to Spotify you will need to create a developers account at here and link it to your Spotify account. Having done that you will then need to create an app in your developers account. The Client ID and Client Secret will then be available which is required by the python code. The playlist feature requires your username is input.