Add opt-in ListenBrainz scrobbling with custom server support - #66
Merged
lostf1sh merged 3 commits intoJul 31, 2026
Merged
Conversation
Issue #55 explicitly asks for a custom endpoint so self-hosted servers like Maloja can receive scrobbles. Route every ListenBrainz request through an endpoint holder that re-roots the API path under a stored custom base URL (path prefixes like Maloja's /apis/listenbrainz are preserved), validate the token against the entered server on connect, and persist the URL alongside the token. The Accounts dialog gains an optional server URL field with its own validation error.
The Accounts page opens straight into linked services now that the Connected Accounts hero and its stat tiles are gone. The ListenBrainz card instead shows the account's total listen count and a server- confirmed "Scrobbling now" row polled from playing-now while the screen is open, with a shimmer skeleton during the first fetch. Both degrade gracefully on ListenBrainz-compatible servers that only implement submission, like Maloja.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #55
Stacked on #65.
What
Opt-in, default-off ListenBrainz scrobbling with an optional custom server URL for self-hosted ListenBrainz-compatible servers (Maloja, self-hosted ListenBrainz).
EncryptedSharedPreferences(same pattern as the Navidrome credentials). Disconnecting deletes the token and any queued listens — consent revocation is a clean boundary./apis/listenbrainz/), the scheme defaults to https, and the token is validated against the entered server before anything is stored.min(4 min, duration/2), hooked intoListeningStatsTracker.finalizeCurrentSession()so every teardown path is covered.listened_atis the session start.listenbrainz_pending_listens(MIGRATION_2_3, schema exported) storing a metadata snapshot at enqueue, capped at 3000 rows. AHiltWorkerflushes with network constraint and exponential backoff, honoringRetry-Afteron 429, dropping invalid rows on 400, and pausing on 401 with a reconnect prompt on the Accounts card.PRIVACY.mdopt-in disclosure,docs/FDROID.mdanti-feature item 7,CHANGELOG.md.MusicBrainz identifier columns are added to the library database as shared groundwork; the manual tag-lookup feature is intentionally not part of this PR.
UI
The Accounts screen gains a ListenBrainz card (connect dialog with token + optional server URL, per-source toggles, queued-listen count, reauth prompt). No screenshots — implemented without an attached device; happy to add some before merge if wanted.
Testing
:app:compileDebugKotlin✅:app:lintDebug✅ (clean):app:testDebugUnitTest✅ (new:ScrobbleManagerTestthreshold/source cases,ListenBrainzEndpointTestURL normalization and request re-rooting,ListeningStatsTrackerTestupdated for the scrobble hook)