feat(playback): mark items fully watched when progress exceeds 80%

When playback position reaches 80% of runtime, send the full runtimeTicks to the server so items appear completely watched, matching the played flag already being set at this threshold.
This commit is contained in:
2026-06-07 11:30:33 +00:00
parent 4a6977eefb
commit df2a468e89

View File

@@ -403,6 +403,7 @@ class JellyfinApiClient @Inject constructor(
) = withContext(Dispatchers.IO) { ) = withContext(Dispatchers.IO) {
if (runtimeTicks <= 0L) return@withContext if (runtimeTicks <= 0L) return@withContext
val normalizedPlaybackPositionTicks = playbackPositionTicks.coerceIn(0L, runtimeTicks) val normalizedPlaybackPositionTicks = playbackPositionTicks.coerceIn(0L, runtimeTicks)
val isPastThreshold = normalizedPlaybackPositionTicks.toDouble() / runtimeTicks.toDouble() >= 0.8
logRequest("updatePlaybackPosition") { logRequest("updatePlaybackPosition") {
if (!ensureConfigured()) { if (!ensureConfigured()) {
return@logRequest return@logRequest
@@ -411,8 +412,8 @@ class JellyfinApiClient @Inject constructor(
itemId = mediaId, itemId = mediaId,
userId = getUserId(), userId = getUserId(),
data = UpdateUserItemDataDto( data = UpdateUserItemDataDto(
playbackPositionTicks = normalizedPlaybackPositionTicks, playbackPositionTicks = if (isPastThreshold) runtimeTicks else normalizedPlaybackPositionTicks,
played = normalizedPlaybackPositionTicks.toDouble() / runtimeTicks.toDouble() >= 0.9, played = isPastThreshold,
) )
) )
result.content result.content