Conversation
Gonic can forward scrobbles to Last.fm/ListenBrainz, but only if the client calls the standard /rest/scrobble endpoint. Add scrobble() to the Subsonic API client and wire PlayerBar to call it: a "now playing" scrobble (submission=false) when a track starts, and a final scrobble (submission=true) once the track has played 4 minutes or 50% of its duration, whichever comes first. Both are fire-and-forget and never block playback. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
/rest/scrobbleendpoint. This client never did. This PR adds that call.scrobble(id, { submission, time })tosrc/lib/api/subsonic.js, following the existingrequest()/buildUrl()pattern. Best-effort — errors are swallowed and never interrupt playback.shouldSubmitScrobble(elapsedSeconds, durationSeconds)tosrc/lib/stores/playerLogic.jsimplementing the standard Last.fm/ListenBrainz threshold: a track counts as "played" once it's been listened to for 4 minutes OR 50% of its duration, whichever comes first.PlayerBar.svelte:submission=false) and resets a per-trackscrobbledflag.onTimeUpdate: onceshouldSubmitScrobblereturns true and the track hasn't been scrobbled yet, fires the final scrobble (submission=true) and sets the flag so it only fires once per track.Test plan
npm testpasses (53/53, including 5 new tests forshouldSubmitScrobblecovering the 4-minute cap, 50% threshold, and unknown-duration cases)npm run buildpasses🤖 Generated with Claude Code