mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-17 15:32:01 +00:00
fix: threshold calculation fix
This commit is contained in:
parent
9491bc944f
commit
f4b1e9ba73
3 changed files with 5 additions and 5 deletions
|
|
@ -4,7 +4,6 @@ import co.touchlab.kermit.Logger
|
||||||
import com.nuvio.app.features.addons.httpGetTextWithHeaders
|
import com.nuvio.app.features.addons.httpGetTextWithHeaders
|
||||||
import com.nuvio.app.features.addons.httpRequestRaw
|
import com.nuvio.app.features.addons.httpRequestRaw
|
||||||
import com.nuvio.app.features.details.MetaDetailsRepository
|
import com.nuvio.app.features.details.MetaDetailsRepository
|
||||||
import com.nuvio.app.features.watchprogress.WatchProgressCompletionPercentThreshold
|
|
||||||
import com.nuvio.app.features.watchprogress.WatchProgressEntry
|
import com.nuvio.app.features.watchprogress.WatchProgressEntry
|
||||||
import com.nuvio.app.features.watchprogress.buildPlaybackVideoId
|
import com.nuvio.app.features.watchprogress.buildPlaybackVideoId
|
||||||
import kotlinx.coroutines.CancellationException
|
import kotlinx.coroutines.CancellationException
|
||||||
|
|
@ -28,6 +27,7 @@ import kotlinx.serialization.decodeFromString
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
private const val BASE_URL = "https://api.trakt.tv"
|
private const val BASE_URL = "https://api.trakt.tv"
|
||||||
|
private const val TRAKT_COMPLETION_PERCENT_THRESHOLD = 80f
|
||||||
private const val HISTORY_LIMIT = 250
|
private const val HISTORY_LIMIT = 250
|
||||||
private const val METADATA_FETCH_TIMEOUT_MS = 3_500L
|
private const val METADATA_FETCH_TIMEOUT_MS = 3_500L
|
||||||
private const val METADATA_FETCH_CONCURRENCY = 5
|
private const val METADATA_FETCH_CONCURRENCY = 5
|
||||||
|
|
@ -468,7 +468,7 @@ object TraktProgressRepository {
|
||||||
lastPositionMs = 0L,
|
lastPositionMs = 0L,
|
||||||
durationMs = 0L,
|
durationMs = 0L,
|
||||||
lastUpdatedEpochMs = rankedTimestamp(item.pausedAt, fallbackIndex),
|
lastUpdatedEpochMs = rankedTimestamp(item.pausedAt, fallbackIndex),
|
||||||
isCompleted = progressPercent >= WatchProgressCompletionPercentThreshold,
|
isCompleted = progressPercent >= TRAKT_COMPLETION_PERCENT_THRESHOLD,
|
||||||
progressPercent = progressPercent,
|
progressPercent = progressPercent,
|
||||||
).normalizedCompletion()
|
).normalizedCompletion()
|
||||||
}
|
}
|
||||||
|
|
@ -502,7 +502,7 @@ object TraktProgressRepository {
|
||||||
lastPositionMs = 0L,
|
lastPositionMs = 0L,
|
||||||
durationMs = 0L,
|
durationMs = 0L,
|
||||||
lastUpdatedEpochMs = rankedTimestamp(item.pausedAt, fallbackIndex),
|
lastUpdatedEpochMs = rankedTimestamp(item.pausedAt, fallbackIndex),
|
||||||
isCompleted = progressPercent >= WatchProgressCompletionPercentThreshold,
|
isCompleted = progressPercent >= TRAKT_COMPLETION_PERCENT_THRESHOLD,
|
||||||
progressPercent = progressPercent,
|
progressPercent = progressPercent,
|
||||||
).normalizedCompletion()
|
).normalizedCompletion()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ data class WatchProgressEntry(
|
||||||
val isEffectivelyCompleted: Boolean
|
val isEffectivelyCompleted: Boolean
|
||||||
get() = isCompleted ||
|
get() = isCompleted ||
|
||||||
(normalizedProgressPercent?.let { it >= WatchProgressCompletionPercentThreshold } == true) ||
|
(normalizedProgressPercent?.let { it >= WatchProgressCompletionPercentThreshold } == true) ||
|
||||||
(durationMs > 0L && lastPositionMs >= durationMs)
|
(durationMs > 0L && isWatchProgressComplete(lastPositionMs, durationMs, false))
|
||||||
|
|
||||||
val progressFraction: Float
|
val progressFraction: Float
|
||||||
get() {
|
get() {
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ object WatchProgressRepository {
|
||||||
lastStreamSubtitle = cached?.lastStreamSubtitle,
|
lastStreamSubtitle = cached?.lastStreamSubtitle,
|
||||||
pauseDescription = cached?.pauseDescription,
|
pauseDescription = cached?.pauseDescription,
|
||||||
lastSourceUrl = cached?.lastSourceUrl,
|
lastSourceUrl = cached?.lastSourceUrl,
|
||||||
isCompleted = entry.duration > 0 && entry.position >= entry.duration,
|
isCompleted = isWatchProgressComplete(entry.position, entry.duration, false),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue