Add opt-in ListenBrainz scrobbling - #63
Closed
lostf1sh wants to merge 1 commit into
Closed
Conversation
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.
What
Re-introduces public scrobbling as a strictly opt-in ListenBrainz integration, reversing the documented removal (
PRIVACY.md,docs/FDROID.md,CHANGELOG.mdare updated in the same change).ListeningStatsTracker.finalizeCurrentSession()— independent of the existing stats floor and of the Subsonic track-end scrobble.listenbrainz_pending_listens(MIGRATION_2_3, idempotent per the migration convention; schema v3 exported). Rows snapshot track metadata at enqueue and are drained oldest-first by aHiltWorkerwith a network constraint and exponential backoff. A batch-level 400 falls back to individual submission so one bad listen can't wedge the queue; 401 pauses flushing until reconnect (listens keep queueing); 429 honorsRetry-After.duration_ms, relying on ListenBrainz's server-side expiry instead of a heartbeat.songs.mb_recording_id/mb_release_id/mb_artist_idcolumns (not yet populated); scrobbles will carry recording MBIDs once tag reading lands.Why
Lets users keep their listening history on their own terms while preserving the app's privacy posture: consent is explicit (token paste), revocation is complete (disconnect clears the queue), and the F-Droid listing requirement is reframed to strictly-opt-in rather than absent.
UI changes
The Accounts screen gains a ListenBrainz card (token dialog with masked input, connection state, queued-listen count, reconnect flow for invalidated tokens, per-source toggles) and a new "Available services" section so services can be connected while others are already linked — previously connect buttons only appeared when no account was connected. Screenshots to follow.
Verification
:app:compileDebugKotlin— passes:app:testDebugUnitTest— passes (newScrobbleManagerTestcovers the threshold edges;ListeningStatsTrackerTestupdated for the new dependency):app:lintDebug— passesAn adversarial review pass was done on the change; its findings (disconnect/enqueue race, missing backup exclusions, missing reconnect path, 401/429 handling, unmasked token field) are all fixed in this branch. Known gap: no unit tests yet for the disconnect-ordering and 401-pause behaviors — they need fakes for EncryptedSharedPreferences/WorkManager.