A cliamp plugin that scrobbles everything you play to ListenBrainz — the free, open-source scrobbling service powered by MusicBrainz.
Works with local files, radio, Spotify, Plex, Navidrome and any other provider cliamp plays. Modeled on the excellent cliamp-lastfm plugin, but for ListenBrainz's simpler token-based API — no API key, no secret, no session key.
- One token, done. Authenticate once with a personal API token — no app registration, no OAuth dance.
- Your data is yours. ListenBrainz is open source and your listen history is freely downloadable (ListenBrainz API).
- Pinning. Pin a track to your profile — a feature Last.fm doesn't have.
Requires cliamp ≥ v1.63 and a ListenBrainz account.
cliamp plugins install geokkjer/cliamp-plugin-listenbrainz
cliamp plugins trust listenbrainzThe plugin installs as listenbrainz (the cliamp-plugin- prefix is
stripped). cliamp plugins trust asks you to review the source and its
permissions before it runs — that's cliamp's normal approval flow.
The plugin runs all ListenBrainz HTTP through curl subprocesses (via
cliamp's exec permission) so a slow or unreachable ListenBrainz can never
stall playback or trip cliamp's 5-second plugin deadline. Allow curl in
~/.config/cliamp/config.toml:
[plugins]
allowed_binaries = "curl"(./setup.sh does this for you.)
Open https://listenbrainz.org/settings/, log in, and copy the API Token.
The easiest way is the setup script — it opens the settings page for you and writes the config:
./setup.shOr edit ~/.config/cliamp/config.toml by hand:
[plugins.listenbrainz]
token = "YOUR-API-TOKEN" # required — from listenbrainz.org/settings
username = "your-lb-username" # optional — enables stats + pinningcliamp plugins call listenbrainz testWith a valid token and a track playing, this prints OK: playing_now accepted by ListenBrainz. Play a track past the halfway point and you'll see
Scrobble Sent: Artist - Title in the status bar.
| Key | Action |
|---|---|
* |
Love / unlove the current track |
# |
Pin / unpin the current track (requires username) |
& |
Cycle mode: normal → silent → off |
Bindings only fire in the main view, and are listed in the Ctrl+K keymap
overlay under "— plugins —".
Run from a shell while cliamp is running:
cliamp plugins call listenbrainz status # mode, config state, queue size, current track
cliamp plugins call listenbrainz test # verify token by submitting a "now playing"| normal | silent | off | |
|---|---|---|---|
| Scrobbling | ✓ | ✓ | ✗ |
| Now playing | ✓ | ✓ | ✗ |
| Love / Pin | ✓ | ✓ | ✗ |
| UI messages | ✓ | ✗ | ✗ |
- Buffered, never blocking. Event hooks (play, pause, stop, scrobble)
never touch the network. They write intents — scrobbles and now-playing —
to the plugin's persistent store
(
~/.local/share/cliamp/plugins/listenbrainz/store.json), and a background worker flushes them. Every request runs in acurlsubprocess via cliamp'sexecAPI (bounded by--max-time 15), whose completion callbacks are not subject to cliamp's 5-second plugin deadline — so even a completely hung ListenBrainz can never abort a hook, stall playback, or lose a scrobble. - Scrobbling. cliamp fires a
track.scrobbleevent once a track is ≥ 50 % played or ≥ 4 minutes in — exactly ListenBrainz's listen criteria. The plugin queues asinglelisten withlistened_atset to when the track actually started. - Now playing. On play, the plugin queues a
playing_nowlisten so your profile shows what you're listening to, and clears it when playback stops. Pausing keeps the badge (the listen is still current). It requestsreturn_msid=true, which also gives us therecording_msidused for love feedback and pinning. - Love / pin. Uses the cached
recording_msidfrom the now-playing submission, falling back to ametadata/lookupby artist + track name. - Retry & backoff. The worker runs every minute, sends scrobbles in batches of up to 20, and backs off exponentially on failures (rate limits, outages, hangs) — nothing is lost, and it all catches up when the API recovers. The next flush is always scheduled first, so even a killed callback can't stop the chain.
- Privacy. Your token never leaves the machine — it lives only in
~/.config/cliamp/config.toml, is sent only toapi.listenbrainz.org, and the plugin makes no other network calls.
| Symptom | Cause / fix |
|---|---|
[ListenBrainz] Not configured on startup |
No token in [plugins.listenbrainz]. Run ./setup.sh. |
curl unavailable via cliamp.exec in plugins.log |
The plugin needs curl allowed: add allowed_binaries = "curl" under [plugins] in config.toml, then restart. Scrobbles buffer until then. |
test command prints FAILED |
Check the token, then look at ~/.config/cliamp/plugins.log for the HTTP status. 401 = wrong token. |
| Scrobble shows "queued for retry" | Network hiccup or rate limit. The queue flushes automatically; no action needed. |
* / # say "no MBID match" |
ListenBrainz couldn't match the track to MusicBrainz by name. Love/pin need a match; scrobbling still works. |
# says "Set username" |
Pinning needs username in the config (it queries your profile). |
lua5.1 test/harness.lua # runs the logic test suite (71 checks, no network)The harness stubs the cliamp API, records every HTTP call the plugin makes, and asserts the exact payloads sent to ListenBrainz — scrobble shape, now playing, love/pin flows, rate-limit queueing and mode gating.
- Adapted from cliamp-lastfm by tetsuo76, licensed CC0.
- API details cross-checked against the ListenBrainz API docs and web-scrobbler's ListenBrainz connector.