mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 16:30:31 +05:30
Treat videos as watched when progress is 25%+
This commit is contained in:
parent
8660e4cf3b
commit
d868c6c911
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user