fix: indexing of beat annotations after unpaired tracks

This commit is contained in:
2026-05-31 12:10:02 +02:00
parent a10102c10a
commit 88db4ad18d
4 changed files with 21 additions and 9 deletions

View File

@@ -110,6 +110,7 @@ class PlaybackService : Service() {
title = item.title,
artist = item.artist,
queueIndex = i,
playlistPosition = item.playlistPosition,
queueSize = queue.size,
reason = reason,
),
@@ -265,6 +266,7 @@ class PlaybackService : Service() {
artist = row.artistName ?: "",
localUri = Uri.parse(uriStr),
durationMsHint = hint,
playlistPosition = row.position,
)
}
index = 0
@@ -300,6 +302,7 @@ class PlaybackService : Service() {
isPlaying = _uiState.value.isPlaying,
currentTrackId = item.id,
currentQueueIndex = index,
currentPlaylistPosition = item.playlistPosition,
queueSize = queue.size,
)
updateProgressFromEngine()
@@ -367,6 +370,8 @@ class PlaybackService : Service() {
durationSeconds = durationSec,
currentTrackId = queue.getOrNull(index)?.id ?: _uiState.value.currentTrackId,
currentQueueIndex = index,
currentPlaylistPosition =
queue.getOrNull(index)?.playlistPosition ?: _uiState.value.currentPlaylistPosition,
queueSize = queue.size,
)
updatePlaybackStateFromEngine()
@@ -566,6 +571,8 @@ class PlaybackService : Service() {
val isPlaying: Boolean,
val currentTrackId: String?,
val currentQueueIndex: Int,
/** 0-based position in the full Spotify playlist for the current track. */
val currentPlaylistPosition: Int,
val queueSize: Int,
) {
companion object {
@@ -578,6 +585,7 @@ class PlaybackService : Service() {
isPlaying = false,
currentTrackId = null,
currentQueueIndex = 0,
currentPlaylistPosition = 0,
queueSize = 0,
)
}
@@ -590,6 +598,8 @@ class PlaybackService : Service() {
val localUri: Uri?,
/** Fallback when the engine has not reported duration yet (from jukebox or default). */
val durationMsHint: Int,
/** 0-based position in the full Spotify playlist. */
val playlistPosition: Int,
)
companion object {