(withdrawn)#1710
Closed
humanperzeus wants to merge 2 commits intolibrespot-org:devfrom
Closed
Conversation
Adds the missing play-count reporting to librespot. Without this, plays performed via librespot are not credited to the user's Spotify account and don't count toward artist/track public play statistics or royalty- eligible streams. This is the long-standing issue tracked in #913. Implementation ports librespot-java's EventService design: - core: extend MercuryRequest with user_fields and add a send_with_fields helper, since event-service requires Accept-Language and X-ClientTimeStamp headers. - core: new event_service module with a tab-delimited EventBuilder and a fire-and-forget send_event over Mercury to hm://event-service/v1/events. - connect: new playback_metrics module modelling the per-track metrics record and building the three event payloads (NewSessionId, NewPlaybackId, TrackTransition). - connect/spirc: drive the metrics from the existing PlayerEvent stream. TrackChanged starts a metrics record (and emits NewSessionId on first load + NewPlaybackId per track), Playing/Paused/Seeked manage listening intervals, EndOfTrack finalizes and emits TrackTransition. Skip / Prev / Disconnect / Shutdown set a pending end reason so the server distinguishes natural completions from skips. Some detailed pipeline metrics (decryptTime, audioKeyTime, fadeOverlap, decodedLength, bitrate) are sent as zero — Spotify's count decision is based on reason_end and the played intervals, not these. Closes #913 Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
- 6 unit tests under connect::playback_metrics::tests covering:
* NewSessionId / NewPlaybackId / TrackTransition byte layout matches
librespot-java's EventBuilder output field-by-field (50 fields for
TrackTransition, all positionally pinned).
* Wire strings for each EndReason (trackdone, fwdbtn, ...).
* Type/sub-type ids (557/3, 558/1, 12/38) — these are reverse-engineered
and undocumented; the test makes any drift loud.
* Interval bookkeeping for paused-mid-play scenarios.
- core: make EventType::ids pub for cross-crate test introspection.
- dashboard: track Spotify Retry-After server-side and refuse outbound
Web API calls until cleared, so background polling can't keep extending
rate-limit lockouts. Add /auth/hard-reset that bounces through Spotify's
global logout to clear stuck session cookies, and show_dialog=true on
/auth/start so account swaps actually swap. Capture librespot's
registered device id from logs and skip /me/player/devices in the E2E
runner (1 fewer rate-limited call).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Contributor
|
You/Claude have reference the discussion at #626 but how are you avoiding/resolving the concerns there? |
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.
Withdrawn.