mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-29 08:20:32 +05:30
Merge pull request #6997 from Bnyro/master
fix: preference to only store watch positions for video doesn't work
This commit is contained in:
commit
a4253a764b
@ -166,7 +166,10 @@ object PlayerHelper {
|
|||||||
get() = watchPositionsPref in listOf("always", "videos")
|
get() = watchPositionsPref in listOf("always", "videos")
|
||||||
|
|
||||||
val watchPositionsAudio: Boolean
|
val watchPositionsAudio: Boolean
|
||||||
get() = watchPositionsPref == "always"
|
get() = watchPositionsPref in listOf("always", "audio")
|
||||||
|
|
||||||
|
val watchPositionsAny: Boolean
|
||||||
|
get() = watchPositionsVideo || watchPositionsAudio
|
||||||
|
|
||||||
val watchHistoryEnabled: Boolean
|
val watchHistoryEnabled: Boolean
|
||||||
get() = PreferenceHelper.getBoolean(
|
get() = PreferenceHelper.getBoolean(
|
||||||
|
@ -313,7 +313,10 @@ abstract class AbstractPlayerService : MediaLibraryService(), MediaLibrarySessio
|
|||||||
abstract suspend fun startPlayback()
|
abstract suspend fun startPlayback()
|
||||||
|
|
||||||
private fun saveWatchPosition() {
|
private fun saveWatchPosition() {
|
||||||
if (isTransitioning || !PlayerHelper.watchPositionsVideo) return
|
val watchPositionsEnabled =
|
||||||
|
(PlayerHelper.watchPositionsAudio && isAudioOnlyPlayer) || (PlayerHelper.watchPositionsVideo && !isAudioOnlyPlayer)
|
||||||
|
|
||||||
|
if (isTransitioning || !watchPositionsEnabled) return
|
||||||
|
|
||||||
exoPlayer?.let { PlayerHelper.saveWatchPosition(it, videoId) }
|
exoPlayer?.let { PlayerHelper.saveWatchPosition(it, videoId) }
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ class VideoOptionsBottomSheet : BaseBottomSheet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// show the mark as watched or unwatched option if watch positions are enabled
|
// show the mark as watched or unwatched option if watch positions are enabled
|
||||||
if (PlayerHelper.watchPositionsVideo || PlayerHelper.watchHistoryEnabled) {
|
if (PlayerHelper.watchPositionsAny || PlayerHelper.watchHistoryEnabled) {
|
||||||
val watchPositionEntry = runBlocking(Dispatchers.IO) {
|
val watchPositionEntry = runBlocking(Dispatchers.IO) {
|
||||||
DatabaseHolder.Database.watchPositionDao().findById(videoId)
|
DatabaseHolder.Database.watchPositionDao().findById(videoId)
|
||||||
}
|
}
|
||||||
|
@ -439,12 +439,14 @@
|
|||||||
<string-array name="watchPosition">
|
<string-array name="watchPosition">
|
||||||
<item>@string/always</item>
|
<item>@string/always</item>
|
||||||
<item>@string/videos</item>
|
<item>@string/videos</item>
|
||||||
|
<item>@string/audio</item>
|
||||||
<item>@string/never</item>
|
<item>@string/never</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="watchPositionValues">
|
<string-array name="watchPositionValues">
|
||||||
<item>always</item>
|
<item>always</item>
|
||||||
<item>videos</item>
|
<item>videos</item>
|
||||||
|
<item>audio</item>
|
||||||
<item>never</item>
|
<item>never</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user