mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Next Airing episode support in Trakt meta provider (#1072)
This commit is contained in:
parent
db2bf5e7be
commit
e697bf7554
1 changed files with 10 additions and 0 deletions
|
@ -4,6 +4,7 @@ import android.net.Uri
|
||||||
import com.lagradost.cloudstream3.*
|
import com.lagradost.cloudstream3.*
|
||||||
import com.fasterxml.jackson.annotation.JsonAlias
|
import com.fasterxml.jackson.annotation.JsonAlias
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty
|
import com.fasterxml.jackson.annotation.JsonProperty
|
||||||
|
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addImdbId
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addImdbId
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTMDbId
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addTMDbId
|
||||||
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
import com.lagradost.cloudstream3.LoadResponse.Companion.addTrailer
|
||||||
|
@ -166,6 +167,7 @@ open class TraktProvider : MainAPI() {
|
||||||
val episodes = mutableListOf<Episode>()
|
val episodes = mutableListOf<Episode>()
|
||||||
val seasons = parseJson<List<Seasons>>(resSeasons)
|
val seasons = parseJson<List<Seasons>>(resSeasons)
|
||||||
val seasonsNames = mutableListOf<SeasonData>()
|
val seasonsNames = mutableListOf<SeasonData>()
|
||||||
|
var nextAir: NextAiring? = null
|
||||||
|
|
||||||
seasons.forEach { season ->
|
seasons.forEach { season ->
|
||||||
|
|
||||||
|
@ -215,6 +217,13 @@ open class TraktProvider : MainAPI() {
|
||||||
description = episode.overview,
|
description = episode.overview,
|
||||||
).apply {
|
).apply {
|
||||||
this.addDate(episode.firstAired)
|
this.addDate(episode.firstAired)
|
||||||
|
if (nextAir == null && this.date != null && this.date!! > unixTimeMS) {
|
||||||
|
nextAir = NextAiring(
|
||||||
|
episode = this.episode!!,
|
||||||
|
unixTime = this.date!!.div(1000L),
|
||||||
|
season = if (this.season == 1) null else this.season,
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -240,6 +249,7 @@ open class TraktProvider : MainAPI() {
|
||||||
this.actors = actors
|
this.actors = actors
|
||||||
this.comingSoon = isUpcoming(mediaDetails.released)
|
this.comingSoon = isUpcoming(mediaDetails.released)
|
||||||
//posterHeaders
|
//posterHeaders
|
||||||
|
this.nextAiring = nextAir
|
||||||
this.seasonNames = seasonsNames
|
this.seasonNames = seasonsNames
|
||||||
this.backgroundPosterUrl = getOriginalWidthImageUrl(backDropUrl)
|
this.backgroundPosterUrl = getOriginalWidthImageUrl(backDropUrl)
|
||||||
this.contentRating = mediaDetails.certification
|
this.contentRating = mediaDetails.certification
|
||||||
|
|
Loading…
Reference in a new issue