fix(subsonic): one listen is one play, and a daily mix played in a Subsonic app is credited to it
release / web (push) Successful in 1m23s
release / go (push) Successful in 1m55s
release / govulncheck (push) Successful in 19s
release / integration (push) Successful in 4m16s
release / android (push) Successful in 4m50s
release / Build signed APK (push) Successful in 5m29s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 17s
release / Verify release artifacts (tag releases only) (push) Skipped

A Subsonic app reports "now playing" when a song starts and "played" when
it ends. The played report used to close the now-playing row as a play of
its own and write a second one, so every listen counted twice, and as a
skip when the app sent the song's start time. The report now completes the
app's own row for that song. A late report for an earlier song no longer
cuts short the song playing now.

Subsonic's scrobble doesn't say where a song was played from, so Minstrel
remembers, per user and app, the daily mix the app last opened (for six
hours). A play of a song in that mix is credited to it: the mix's metrics
count it and its rotation moves on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-25 21:48:17 -05:00
co-authored by Claude Opus 5.5
parent 7f7e946bad
commit 333523b30e
8 changed files with 477 additions and 88 deletions
+3 -1
View File
@@ -36,10 +36,12 @@ import (
// method answering that scanning is not available.
func Mount(r chi.Router, pool *pgxpool.Pool, logger *slog.Logger, cfg Config, events *playevents.Writer, hops func() int, picker *recommendation.Picker, lists *playlists.Service, startScan StartScan) {
b := &browseHandlers{pool: pool}
recall := newMixRecall()
m := newMediaHandlers(pool, events, logger)
m.recall = recall
u := &userHandlers{lookup: dbq.New(pool).GetUserByUsername, list: dbq.New(pool).ListUsers}
sc := &scanHandlers{pool: pool, start: startScan}
p := &pickHandlers{pool: pool, picker: picker, playlists: lists, logger: logger}
p := &pickHandlers{pool: pool, picker: picker, playlists: lists, logger: logger, recall: recall}
r.Route("/rest", func(rest chi.Router) {
// The one method the OpenSubsonic spec has answer without credentials.
register(rest, "/getOpenSubsonicExtensions", handleGetOpenSubsonicExtensions)