Files
minstrel/internal/scrobble/threshold.go
T
bvandeusenandClaude Opus 5.5 21adbc2283
release / web (push) Successful in 1m43s
release / go (push) Failing after 2m6s
release / govulncheck (push) Successful in 20s
release / integration (push) Failing after 2m48s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Publish the release image to GHCR (dispatch only) (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / android (push) Canceled after 2m8s
release / Build signed APK (push) Canceled after 1m47s
test: DELIBERATE BREAK, expected red, reverted next (#8299)
- backup Coverage: a listed table missing from the schema goes unreported
  -> TestCoverage
- scrobble: exactly four minutes no longer qualifies -> TestQualifies
- listenbrainz submit: a 400 retried as transient
  -> TestClient_RefusalsMapToWhatTheWorkerDoes
- playevents: either skip condition alone is a skip
  -> TestRecordPlayEnded_AppliesTheSkipRule
- recsettings: tag scales up to 100 -> TestUpdateTaste_TagScales
- apierror From: a plain error answered 400 -> TestFrom
- auth RequireAdmin: no user in the context passes through
  -> TestRequireAdmin
- providers: a 404 is transient
  -> TestHTTPClient_GetJSON_AnswersNotFoundOrTransient
- quarantine: any reason accepted -> TestService_Refusals
- playsessions: exactly the window starts a new session
  -> TestFindOrCreate_JoinsWithinTheWindowAndStartsAfterIt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 15:26:57 -05:00

15 lines
698 B
Go

// Package scrobble owns the outbound-scrobble pipeline: threshold detection,
// the queue write path, and the worker goroutine. The HTTP client is in
// internal/scrobble/listenbrainz; this package consumes it.
package scrobble
// Qualifies returns true if a closed play_event meets ListenBrainz's
// recommended scrobble threshold: ≥240 seconds played OR ≥50% of the
// track length played.
//
// The two thresholds are deliberately separate from the skip-detection
// thresholds, which feed the scoring formula's skip penalty instead.
func Qualifies(durationPlayedMs int, completionRatio float64) bool {
return durationPlayedMs > 240_000 /* DELIBERATE BREAK */ || completionRatio >= 0.5
}