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
+1 -1
View File
@@ -286,7 +286,7 @@ func TestRecordPlaySkipped_AlwaysSkipFlagAndSkipEventRow(t *testing.T) {
func TestRecordSyntheticCompletedPlay_WritesBothRows(t *testing.T) {
f := newFixture(t, 200_000)
now := time.Now().UTC()
if err := f.w.RecordSyntheticCompletedPlay(context.Background(), f.user, f.track, "feishin", now); err != nil {
if err := f.w.RecordSyntheticCompletedPlay(context.Background(), f.user, f.track, "feishin", "", now); err != nil {
t.Fatalf("synthetic: %v", err)
}
rows, _ := f.pool.Query(context.Background(),