From 4bf526dc3698bd903f06b720559a6d9c9f2489f3 Mon Sep 17 00:00:00 2001 From: hexated Date: Mon, 3 Jul 2023 00:26:33 +0700 Subject: [PATCH] Anichi: fix missing episode --- Anichi/build.gradle.kts | 2 +- Anichi/src/main/kotlin/com/hexated/Anichi.kt | 26 +++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/Anichi/build.gradle.kts b/Anichi/build.gradle.kts index 2b853728..24eea240 100644 --- a/Anichi/build.gradle.kts +++ b/Anichi/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.konan.properties.Properties // use an integer for version numbers -version = 3 +version = 4 android { defaultConfig { diff --git a/Anichi/src/main/kotlin/com/hexated/Anichi.kt b/Anichi/src/main/kotlin/com/hexated/Anichi.kt index ce394633..bcac5850 100644 --- a/Anichi/src/main/kotlin/com/hexated/Anichi.kt +++ b/Anichi/src/main/kotlin/com/hexated/Anichi.kt @@ -143,19 +143,21 @@ class Anichi : MainAPI() { val poster = showData.thumbnail val type = getType(showData.type ?: "") - val episodes = showData.availableEpisodes.let { + val episodes = showData.availableEpisodesDetail.let { if (it == null) return@let Pair(null, null) if (showData.Id == null) return@let Pair(null, null) - - Pair(if (it.sub != 0) ((1..it.sub).map { epNum -> - Episode( - AnichiLoadData(showData.Id, "sub", epNum).toJson(), episode = epNum - ) - }) else null, if (it.dub != 0) ((1..it.dub).map { epNum -> - Episode( - AnichiLoadData(showData.Id, "dub", epNum).toJson(), episode = epNum - ) - }) else null) + Pair( + it.sub.map { eps -> + Episode( + AnichiLoadData(showData.Id, "sub", eps).toJson(), eps + ) + }.reversed(), + it.dub.map { eps -> + Episode( + AnichiLoadData(showData.Id, "dub", eps).toJson(), eps + ) + }.reversed() + ) } val characters = showData.characters?.map { @@ -396,7 +398,7 @@ class Anichi : MainAPI() { data class AnichiLoadData( val hash: String, val dubStatus: String, - val episode: Int + val episode: String ) data class AkIframe(