Treat videos as watched when progress is 25%+

This commit is contained in:
Bnyro 2023-06-25 12:45:31 +02:00
parent 8660e4cf3b
commit d868c6c911
2 changed files with 9 additions and 10 deletions

View File

@ -281,15 +281,14 @@ class SubscriptionsFragment : Fragment() {
}
private fun removeWatchVideosFromFeed(streams: List<StreamItem>): List<StreamItem> {
return runBlocking {
streams.filter {
runBlocking(Dispatchers.IO) {
runCatching {
val watchPosition = DatabaseHolder.Database.watchPositionDao()
.findById(it.url.orEmpty().toID())?.position?.div(1000)
(watchPosition ?: 0) < 0.9 * (it.duration ?: 1L)
}.getOrDefault(false)
}
return streams.filter {
runBlocking(Dispatchers.IO) {
val historyItem = DatabaseHolder.Database.watchPositionDao()
.findById(it.url.orEmpty().toID()) ?: return@runBlocking true
val progress = historyItem.position / 1000
val duration = it.duration ?: 0
// show video only in feed when watched less than 1/4
progress < 0.25f * duration
}
}
}

View File

@ -374,7 +374,7 @@
<string name="color_violet">Versatile Violet</string>
<string name="failed_fetching_instances">Could not fetch available instances.</string>
<string name="hide_watched_from_feed">Hide watched videos from feed</string>
<string name="hide_watched_from_feed_summary">Don\'t show videos being watched more than 90% in the subscriptions tab.</string>
<string name="hide_watched_from_feed_summary">Don\'t show videos being watched more than 25% in the subscriptions tab.</string>
<string name="playlistUrl">Playlist URL</string>
<string name="pause_on_quit">Pause on quit</string>
<string name="shuffle">Shuffle</string>