Add premium seasons to Crunchy

This commit is contained in:
Blatzar 2022-09-12 17:23:24 +02:00
parent 9d90967115
commit d1858e8c7b
2 changed files with 31 additions and 15 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 3 version = 4
cloudstream { cloudstream {

View file

@ -298,16 +298,19 @@ class KrunchyProvider : MainAPI() {
epDesc = "$epDesc" epDesc = "$epDesc"
} }
val isPremiumDubbed =
isPremium && seasonName != null && (seasonName.contains("Dub") || seasonName.contains(
"Russian"
) || seasonName.contains("Spanish"))
val epi = Episode( val epi = Episode(
fixUrl(ep.attr("href")), fixUrl(ep.attr("href")),
"$epTitle", "$epTitle",
posterUrl = poster?.replace("widestar", "full")?.replace("wide", "full"), posterUrl = poster?.replace("widestar", "full")?.replace("wide", "full"),
description = epDesc description = epDesc,
season = if (isPremium) -1 else 1
) )
if (isPremium && seasonName != null && (seasonName.contains("Dub") || seasonName.contains( if (isPremiumDubbed) {
"Russian"
) || seasonName.contains("Spanish"))
) {
premiumDubEpisodes.add(epi) premiumDubEpisodes.add(epi)
} else if (isPremium) { } else if (isPremium) {
premiumSubEpisodes.add(epi) premiumSubEpisodes.add(epi)
@ -341,20 +344,33 @@ class KrunchyProvider : MainAPI() {
this.engName = title this.engName = title
if (subEpisodes.isNotEmpty()) addEpisodes(DubStatus.Subbed, subEpisodes.reversed()) if (subEpisodes.isNotEmpty()) addEpisodes(DubStatus.Subbed, subEpisodes.reversed())
if (dubEpisodes.isNotEmpty()) addEpisodes(DubStatus.Dubbed, dubEpisodes.reversed()) if (dubEpisodes.isNotEmpty()) addEpisodes(DubStatus.Dubbed, dubEpisodes.reversed())
// TODO add arbitrary seasons
//if (premiumDubEpisodes.isNotEmpty()) addEpisodes( if (premiumDubEpisodes.isNotEmpty()) addEpisodes(
// DubStatus.PremiumDub, DubStatus.Dubbed,
// premiumDubEpisodes.reversed() premiumDubEpisodes.reversed()
// ) )
// if (premiumSubEpisodes.isNotEmpty()) addEpisodes( if (premiumSubEpisodes.isNotEmpty()) addEpisodes(
// DubStatus.PremiumSub, DubStatus.Subbed,
// premiumSubEpisodes.reversed() premiumSubEpisodes.reversed()
// ) )
this.plot = description this.plot = description
this.tags = genres this.tags = genres
this.year = year this.year = year
this.recommendations = recommendations this.recommendations = recommendations
this.seasonNames = listOf(
SeasonData(
1,
"Free",
null
),
SeasonData(
-1,
"Premium",
null
),
)
} }
} }