forked from recloudstream/cloudstream
fixed autosync
This commit is contained in:
parent
e5515b575c
commit
ef00cf6589
1 changed files with 8 additions and 3 deletions
|
@ -387,6 +387,8 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var maxEpisodeSet: Int? = null
|
||||||
|
|
||||||
override fun playerPositionChanged(posDur: Pair<Long, Long>) {
|
override fun playerPositionChanged(posDur: Pair<Long, Long>) {
|
||||||
val (position, duration) = posDur
|
val (position, duration) = posDur
|
||||||
viewModel.getId()?.let {
|
viewModel.getId()?.let {
|
||||||
|
@ -434,7 +436,9 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
var isOpVisible = false
|
var isOpVisible = false
|
||||||
when (val meta = currentMeta) {
|
when (val meta = currentMeta) {
|
||||||
is ResultEpisode -> {
|
is ResultEpisode -> {
|
||||||
if (percentage >= UPDATE_SYNC_PROGRESS_PERCENTAGE) {
|
if (percentage >= UPDATE_SYNC_PROGRESS_PERCENTAGE && (maxEpisodeSet
|
||||||
|
?: -1) < meta.episode
|
||||||
|
) {
|
||||||
context?.let { ctx ->
|
context?.let { ctx ->
|
||||||
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
|
val settingsManager = PreferenceManager.getDefaultSharedPreferences(ctx)
|
||||||
if (settingsManager.getBoolean(
|
if (settingsManager.getBoolean(
|
||||||
|
@ -442,6 +446,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
maxEpisodeSet = meta.episode
|
||||||
sync.modifyMaxEpisode(meta.episode)
|
sync.modifyMaxEpisode(meta.episode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue