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) {
|
) = 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
|
||||||
|
|||||||
Reference in New Issue
Block a user