fix(subsonic): a scrobble of an unknown song answers not found (70) (#8125)
release / web (push) Successful in 1m20s
release / go (push) Successful in 1m49s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 4m3s
release / android (push) Successful in 4m26s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / Build signed APK (push) Canceled after 4m43s

A scrobble whose id named no track reached the play writer and came back
as a generic failure (0). The handler now looks the song up first, as
stream does, and answers 70 with nothing recorded; a lookup that fails
for another reason is still a generic error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-28 11:56:12 -05:00
co-authored by Claude Opus 5.5
parent 4ca6c6be38
commit 1c4307e6ef
2 changed files with 34 additions and 1 deletions
+12 -1
View File
@@ -200,8 +200,19 @@ func (m *mediaHandlers) handleScrobble(w http.ResponseWriter, r *http.Request) {
}
at = playevents.ClampClientTime(at, user.CreatedAt.Time, time.Now().UTC())
}
q := dbq.New(m.pool)
// A song the library doesn't hold is "not found" (70), as stream and
// getSong answer it, not a failure to record.
if _, err := q.GetTrackByID(r.Context(), trackID); err != nil {
if errors.Is(err, pgx.ErrNoRows) {
WriteFail(w, r, ErrDataNotFound, "Track not found")
return
}
WriteFail(w, r, ErrGeneric, "Failed to load track")
return
}
clientID := params.Get("c")
source, err := m.recall.sourceFor(r.Context(), dbq.New(m.pool), user.ID, clientID, trackID)
source, err := m.recall.sourceFor(r.Context(), q, user.ID, clientID, trackID)
if err != nil {
// Crediting a mix is a refinement; the play itself still counts.
m.logger.Warn("subsonic: scrobble mix lookup failed", "err", err)