mirror of
https://github.com/bbara04/Purefin.git
synced 2026-07-23 19:26:50 +00:00
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:
@@ -403,6 +403,7 @@ class JellyfinApiClient @Inject constructor(
|
||||
) = withContext(Dispatchers.IO) {
|
||||
if (runtimeTicks <= 0L) return@withContext
|
||||
val normalizedPlaybackPositionTicks = playbackPositionTicks.coerceIn(0L, runtimeTicks)
|
||||
val isPastThreshold = normalizedPlaybackPositionTicks.toDouble() / runtimeTicks.toDouble() >= 0.8
|
||||
logRequest("updatePlaybackPosition") {
|
||||
if (!ensureConfigured()) {
|
||||
return@logRequest
|
||||
@@ -411,8 +412,8 @@ class JellyfinApiClient @Inject constructor(
|
||||
itemId = mediaId,
|
||||
userId = getUserId(),
|
||||
data = UpdateUserItemDataDto(
|
||||
playbackPositionTicks = normalizedPlaybackPositionTicks,
|
||||
played = normalizedPlaybackPositionTicks.toDouble() / runtimeTicks.toDouble() >= 0.9,
|
||||
playbackPositionTicks = if (isPastThreshold) runtimeTicks else normalizedPlaybackPositionTicks,
|
||||
played = isPastThreshold,
|
||||
)
|
||||
)
|
||||
result.content
|
||||
|
||||
Reference in New Issue
Block a user