mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
fix (resume): based on resume episode restore season, range, dubbed
This commit is contained in:
parent
6d51c59b18
commit
e0490dc8ae
5 changed files with 38 additions and 3 deletions
|
@ -1022,6 +1022,7 @@ class GeneratorPlayer : FullScreenPlayer() {
|
||||||
resumeMeta.id,
|
resumeMeta.id,
|
||||||
resumeMeta.episode,
|
resumeMeta.episode,
|
||||||
resumeMeta.season,
|
resumeMeta.season,
|
||||||
|
resumeMeta.dubStatus,
|
||||||
isFromDownload = false
|
isFromDownload = false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,7 @@ data class ResultEpisode(
|
||||||
val videoWatchState: VideoWatchState,
|
val videoWatchState: VideoWatchState,
|
||||||
/** Sum of all previous season episode counts + episode */
|
/** Sum of all previous season episode counts + episode */
|
||||||
val totalEpisodeIndex: Int? = null,
|
val totalEpisodeIndex: Int? = null,
|
||||||
|
val dubStatus: DubStatus? = null
|
||||||
)
|
)
|
||||||
|
|
||||||
fun ResultEpisode.getRealPosition(): Long {
|
fun ResultEpisode.getRealPosition(): Long {
|
||||||
|
@ -85,6 +86,7 @@ fun buildResultEpisode(
|
||||||
tvType: TvType,
|
tvType: TvType,
|
||||||
parentId: Int,
|
parentId: Int,
|
||||||
totalEpisodeIndex: Int? = null,
|
totalEpisodeIndex: Int? = null,
|
||||||
|
dubStatus: DubStatus? = null,
|
||||||
): ResultEpisode {
|
): ResultEpisode {
|
||||||
val posDur = getViewPos(id)
|
val posDur = getViewPos(id)
|
||||||
val videoWatchState = getVideoWatchState(id) ?: VideoWatchState.None
|
val videoWatchState = getVideoWatchState(id) ?: VideoWatchState.None
|
||||||
|
@ -107,7 +109,8 @@ fun buildResultEpisode(
|
||||||
tvType,
|
tvType,
|
||||||
parentId,
|
parentId,
|
||||||
videoWatchState,
|
videoWatchState,
|
||||||
totalEpisodeIndex
|
totalEpisodeIndex,
|
||||||
|
dubStatus
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2241,7 +2241,8 @@ class ResultViewModel2 : ViewModel() {
|
||||||
fillers.getOrDefault(episode, false),
|
fillers.getOrDefault(episode, false),
|
||||||
loadResponse.type,
|
loadResponse.type,
|
||||||
mainId,
|
mainId,
|
||||||
totalIndex
|
totalIndex,
|
||||||
|
ep.key
|
||||||
)
|
)
|
||||||
|
|
||||||
val season = eps.seasonIndex ?: 0
|
val season = eps.seasonIndex ?: 0
|
||||||
|
@ -2290,7 +2291,8 @@ class ResultViewModel2 : ViewModel() {
|
||||||
null,
|
null,
|
||||||
loadResponse.type,
|
loadResponse.type,
|
||||||
mainId,
|
mainId,
|
||||||
totalIndex
|
totalIndex,
|
||||||
|
null
|
||||||
)
|
)
|
||||||
|
|
||||||
val season = ep.seasonIndex ?: 0
|
val season = ep.seasonIndex ?: 0
|
||||||
|
@ -2322,6 +2324,7 @@ class ResultViewModel2 : ViewModel() {
|
||||||
null,
|
null,
|
||||||
loadResponse.type,
|
loadResponse.type,
|
||||||
mainId,
|
mainId,
|
||||||
|
null,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -2345,6 +2348,7 @@ class ResultViewModel2 : ViewModel() {
|
||||||
null,
|
null,
|
||||||
loadResponse.type,
|
loadResponse.type,
|
||||||
mainId,
|
mainId,
|
||||||
|
null,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -2368,6 +2372,7 @@ class ResultViewModel2 : ViewModel() {
|
||||||
null,
|
null,
|
||||||
loadResponse.type,
|
loadResponse.type,
|
||||||
mainId,
|
mainId,
|
||||||
|
null,
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -2454,9 +2459,30 @@ class ResultViewModel2 : ViewModel() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
restoreSeasonAndRange(resume)
|
||||||
|
|
||||||
return ResumeWatchingStatus(progress = progress, isMovie = isMovie, result = episode)
|
return ResumeWatchingStatus(progress = progress, isMovie = isMovie, result = episode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun restoreSeasonAndRange(resume: VideoDownloadHelper.ResumeWatching) {
|
||||||
|
// restore season based on resume details
|
||||||
|
resume.season?.apply {
|
||||||
|
changeSeason(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
// restore dubStatus based on resume details
|
||||||
|
resume.dubStatus?.apply {
|
||||||
|
changeDubStatus(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
// restore range based on resume details
|
||||||
|
currentRanges[currentIndex]?.first {
|
||||||
|
it.endEpisode >= (resume.episode ?: 0)
|
||||||
|
}?.apply {
|
||||||
|
changeRange(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun loadTrailers(loadResponse: LoadResponse) = ioSafe {
|
private fun loadTrailers(loadResponse: LoadResponse) = ioSafe {
|
||||||
_trailers.postValue(
|
_trailers.postValue(
|
||||||
getTrailers(
|
getTrailers(
|
||||||
|
|
|
@ -360,6 +360,7 @@ object DataStoreHelper {
|
||||||
null,
|
null,
|
||||||
it.episode,
|
it.episode,
|
||||||
it.season,
|
it.season,
|
||||||
|
it.dubStatus,
|
||||||
it.isFromDownload,
|
it.isFromDownload,
|
||||||
it.updateTime
|
it.updateTime
|
||||||
)
|
)
|
||||||
|
@ -374,6 +375,7 @@ object DataStoreHelper {
|
||||||
episodeId: Int?,
|
episodeId: Int?,
|
||||||
episode: Int?,
|
episode: Int?,
|
||||||
season: Int?,
|
season: Int?,
|
||||||
|
dubStatus: DubStatus? = null,
|
||||||
isFromDownload: Boolean = false,
|
isFromDownload: Boolean = false,
|
||||||
updateTime: Long? = null,
|
updateTime: Long? = null,
|
||||||
) {
|
) {
|
||||||
|
@ -386,6 +388,7 @@ object DataStoreHelper {
|
||||||
episodeId,
|
episodeId,
|
||||||
episode,
|
episode,
|
||||||
season,
|
season,
|
||||||
|
dubStatus,
|
||||||
updateTime ?: System.currentTimeMillis(),
|
updateTime ?: System.currentTimeMillis(),
|
||||||
isFromDownload
|
isFromDownload
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.lagradost.cloudstream3.utils
|
package com.lagradost.cloudstream3.utils
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.cloudstream3.DubStatus
|
||||||
import com.lagradost.cloudstream3.TvType
|
import com.lagradost.cloudstream3.TvType
|
||||||
object VideoDownloadHelper {
|
object VideoDownloadHelper {
|
||||||
data class DownloadEpisodeCached(
|
data class DownloadEpisodeCached(
|
||||||
|
@ -30,6 +31,7 @@ object VideoDownloadHelper {
|
||||||
@JsonProperty("episodeId") val episodeId: Int?,
|
@JsonProperty("episodeId") val episodeId: Int?,
|
||||||
@JsonProperty("episode") val episode: Int?,
|
@JsonProperty("episode") val episode: Int?,
|
||||||
@JsonProperty("season") val season: Int?,
|
@JsonProperty("season") val season: Int?,
|
||||||
|
@JsonProperty("dubStatus") val dubStatus: DubStatus?,
|
||||||
@JsonProperty("updateTime") val updateTime: Long,
|
@JsonProperty("updateTime") val updateTime: Long,
|
||||||
@JsonProperty("isFromDownload") val isFromDownload: Boolean,
|
@JsonProperty("isFromDownload") val isFromDownload: Boolean,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue