scrobble: only dedupe when the track was already announced

The now-playing suppression keyed off the item id alone, so a track loaded while paused (which sets the tracked id without announcing) never sent its first now-playing when playback then started from the beginning. Gate the suppression on nowPlayingSent as well, and cover that case plus the transition at the combine boundary.
This commit is contained in:
austinried
2026-10-09 12:31:48 +00:00
parent cfb663c250
commit 20c6ba526f
3 changed files with 40 additions and 2 deletions
@@ -59,7 +59,7 @@ class ScrobblePolicy(
item?.id != songId ||
(item != null && item.id == lastItemId && positionMs < previousPosition && positionMs <= RESTART_POSITION_MS)
if (restarted) {
val sameSong = item != null && item.id == songId
val alreadyAnnounced = nowPlayingSent && item?.id == songId
songId = item?.id
lastItemId = null
playedMs = 0
@@ -69,7 +69,7 @@ class ScrobblePolicy(
if (item == null || !isPlaying) return null
nowPlayingSent = true
startedAt = now()
return if (sameSong) null else Scrobble.NowPlaying(item.id)
return if (alreadyAnnounced) null else Scrobble.NowPlaying(item.id)
}
lastPositionMs = positionMs
lastItemId = item?.id