Skip to content

Spotify

Type librespot_client · needs the internet · set up first: Needs go-librespot running on this Pi, with its API server switched on..

The song Spotify is playing on this device: its title, artist, album and album cover. It works with go-librespot, a program that makes the device a Spotify speaker: in the Spotify app, pick the device (go-librespot's device_name) as the speaker.

It is an interrupt plugin (level = "interrupt", its default): while a song plays, it takes over the screen; when the music stops, the other plugins are shown again. A paused song stays on the screen for idle_timeout seconds (default 10), so a short pause doesn't change the screen.

At each update the plugin reads go-librespot's status (http://localhost:<port>/status). go-librespot's API server (the part that answers these questions) must be switched on in its config.yml:

server:
  enabled: true
  port: 24879

Then restart go-librespot. The server only answers programs on the same device (unless its address says otherwise), so PaperPi and go-librespot must run on the same device.

The album cover is downloaded once (at most 2 MB, JPEG or PNG) and saved in the plugin's storage folder, so a song played again doesn't download it again. When the disk is nearly full, covers are not saved. A song without a usable cover is shown with a plain picture of a record. The plugin also saves a small file with the time the song was paused, because each update is a new program that can't remember it.

When go-librespot doesn't answer (not running, or the wrong port), the update fails, and PaperPi tries again at the next update. When nobody plays to it, the plugin has nothing to show, which is not a failure.

Layouts

Layout Shows
two_column_three_row (default) the cover with the artist and album next to it, the title below
album_art_title a large cover with the title below it
cover_art_only only the cover
two_rows_text_only the title and the artist
three_rows_text_only the title, the artist and the album

Titles are in Oswald, the artist and album in Montserrat SemiBold, as in PaperPi v1. Long texts are drawn smaller; text that still doesn't fit ends with "…". The fonts are Oswald by The Oswald Project Authors and Montserrat by The Montserrat Project Authors, under the SIL Open Font License (fonts/Oswald-OFL.txt, fonts/Montserrat-OFL.txt).

Settings

Setting Default Meaning
port 24879 port of go-librespot's API server: server.port in its config.yml
idle_timeout 10 seconds a paused song stays on the screen before other plugins are shown

It suggests a refresh every 10 seconds.

On the settings page, the Find go-librespot button reads go-librespot's config.yml on this device and offers its port. It looks in the folder of each go-librespot program that runs now (its --config_dir), then in /var/lib/go-librespot/ and ~/.config/go-librespot/. For each file it shows the player's name, the port, and whether go-librespot answers on it now, or what to change when its API server is off.

PaperPi v1's player_name setting is gone: go-librespot's status only describes its own player.

In the config file (every other setting is in the settings reference):

[[plugin]]
id = "librespot_client-e17e8f3c"
name = "Spotify"
type = "librespot_client"
port = 24879
idle_timeout = 30

Try it without a screen: uv run paperpi render librespot_client (sample song), or with the song playing now: uv run paperpi render librespot_client --live.

All settings

Made from the plugin's code, so always up to date.

Setting Default What it does
port 24879 Port of go-librespot's API server: server.port in its config.yml
idle_timeout 10 Seconds a paused song stays on the screen before other plugins are shown

Its suggestions for settings every plugin has (a block that sets one of them uses that value instead):

Setting Default What it does
refresh 10 Seconds between updates (at least 5). Leave it out to use the plugin's suggestion
level "interrupt" When it is shown: alert, interrupt or rotation. Leave it out to use the plugin's suggestion
layout "two_column_three_row" Which layout (see the plugin's page). Leave it out to use the first
storage_mb 500 Most megabytes this plugin may keep in its storage folder; over it, the files changed longest ago are removed first. Leave it out to use the plugin's suggestion
storage_days 30 Files the plugin has not changed for this many days are removed (0 = keep them). Leave it out to use the plugin's suggestion

Sample images

The sample cover, sample/cover.png, was drawn for PaperPi; the sample song is made up. All sample images are in tests/images/, named librespot_client-<layout>-<screen>.png, where <screen> is 9in7 (9.7", 1200x825, 16 grays), 7in5 (7.5", 800x480, black and white) or 5in65 (5.65", 600x448, 7 colours).

two_column_three_row, 9.7" album_art_title, 9.7" cover_art_only, 9.7"
two_column_three_row album_art_title cover_art_only
two_rows_text_only, 9.7" three_rows_text_only, 9.7" two_column_three_row, 5.65" colour
two_rows_text_only three_rows_text_only colour