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
+6
View File
@@ -25,6 +25,9 @@ type pickHandlers struct {
picker *recommendation.Picker
playlists *playlists.Service
logger *slog.Logger
// recall notes the daily mix an app opens, so its plays are credited
// to that mix (see mixRecall).
recall *mixRecall
}
// ---- getPlaylists / getPlaylist ----
@@ -163,6 +166,9 @@ func (h *pickHandlers) getPlaylist(w http.ResponseWriter, r *http.Request) {
WriteFail(w, r, ErrGeneric, "Playlist unavailable")
return
}
if detail.Kind == "system" && detail.SystemVariant != nil {
h.recall.remember(user.ID, r.URL.Query().Get("c"), *detail.SystemVariant)
}
head := playlistRef(&detail.PlaylistRow)
head.SongCount = len(songs)
head.Duration = 0