Route scrobbles through Multi-Scrobbler instead of Last.fm
Summary
Send scrobbles and now-playing updates to the self-hosted Multi-Scrobbler instance instead of talking to Last.fm directly, so album-sort listens flow through the same pipeline as Plex and whatever else is downstream of MS (custom site, etc.) — one source of truth, one dedupe/retry surface.
- New
src/lib/server/api/multiscrobbler.tsposts to${MULTI_SCROBBLER_URL}/1/submit-listens(ListenBrainz-compatible ingress) withAuthorization: Token ${MULTI_SCROBBLER_TOKEN}. Submission client taggedalbum-sort. Completed listens uselisten_type: "single"withlistened_at; now-playing useslisten_type: "playing_now". - Routes moved
api/lastfm/*→api/scrobble/{now-playing,submit,status}. OAuth flow (auth/callback/disconnect) removed — no per-user session needed when MS handles the forwarding. - Deleted
src/lib/server/api/lastfm.ts(API signing,exchangeToken, session helpers).LASTFM_API_KEY/LASTFM_API_SECRETenv vars no longer used by album-sort. - Settings UI collapsed to a "configured / not configured" indicator referencing
MULTI_SCROBBLER_URLandMULTI_SCROBBLER_TOKEN. - Orphan
lastfm_session_key/lastfm_usernamerows in the settings KV are harmless and left in place (nothing reads them anymore).
Deploy notes (homelab repo)
- In
roles/album_sort/templates/env/album-sort.env.j2: dropLASTFM_API_KEY/LASTFM_API_SECRET, add:MULTI_SCROBBLER_URL=http://multi-scrobbler:9078 MULTI_SCROBBLER_TOKEN={{ album_sort_multi_scrobbler_token }} - In
roles/media_consumption/templates/config/multi-scrobbler/config.json.j2, add a new source alongside Plex:(Both sides share the same token — it's the ingress auth.){ "type": "listenbrainz", "name": "album-sort", "data": { "token": "{{ multi_scrobbler_album_sort_token }}" } } - Restart
multi-scrobblerbefore redeployingalbum_sortso the new source is live.
Both containers are already on the shared Docker network, so http://multi-scrobbler:9078 is reachable container-to-container — no compose changes needed.
Test plan
-
pnpm run buildpasses (verified locally) -
With MULTI_SCROBBLER_URL/MULTI_SCROBBLER_TOKENunset, playback works and scrobble requests short-circuit (204/empty success) — no errors in logs -
After deploy, play a track in album-sort and confirm it appears as a "now playing" in Multi-Scrobbler's dashboard, then as a completed listen after ~50% / 30s -
Confirm the Multi-Scrobbler → Last.fm forwarding fires for album-sort listens (same scrobble appears on Last.fm) -
Settings page shows "Configured" when env vars are present, "Not configured" when missing