mirror of
https://github.com/austinried/subtracks.git
synced 2026-11-11 07:29:14 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user