Skip to content

(withdrawn)#1710

Closed
humanperzeus wants to merge 2 commits intolibrespot-org:devfrom
humanperzeus:feat/play-count-reporting
Closed

(withdrawn)#1710
humanperzeus wants to merge 2 commits intolibrespot-org:devfrom
humanperzeus:feat/play-count-reporting

Conversation

@humanperzeus
Copy link
Copy Markdown

@humanperzeus humanperzeus commented Apr 30, 2026

Withdrawn.

CZeus and others added 2 commits April 29, 2026 21:33
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]>
@kingosticks
Copy link
Copy Markdown
Contributor

You/Claude have reference the discussion at #626 but how are you avoiding/resolving the concerns there?

@humanperzeus humanperzeus changed the title feat: report play counts via Spotify event-service (closes #913) (withdrawn) Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants