From a4b8c027990b629afe37521c140e0239dbb68a62 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Wed, 12 Apr 2023 00:31:56 +0300 Subject: [PATCH] League of Legends: fix series list (#15833) * League of Legends: update for extensions-lib 1.4 * League of Legends: fix series list --- src/all/leagueoflegends/build.gradle | 2 +- .../all/leagueoflegends/LOLModels.kt | 12 +++++------ .../all/leagueoflegends/LOLUniverse.kt | 21 ++++++++++++------- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/all/leagueoflegends/build.gradle b/src/all/leagueoflegends/build.gradle index 47c2eacce..f055e0673 100644 --- a/src/all/leagueoflegends/build.gradle +++ b/src/all/leagueoflegends/build.gradle @@ -6,7 +6,7 @@ ext { extName = 'League of Legends' pkgNameSuffix = 'all.leagueoflegends' extClass = '.LOLFactory' - extVersionCode = 1 + extVersionCode = 2 } apply from: "$rootDir/common.gradle" diff --git a/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLModels.kt b/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLModels.kt index 59edeccf8..fcd2b56cd 100644 --- a/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLModels.kt +++ b/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLModels.kt @@ -24,22 +24,22 @@ data class LOLData( @Serializable data class LOLComic( - val title: String, + val title: String? = null, val subtitle: String? = null, val index: Float? = null, - private val url: String, - val description: String, - val background: LOLImage, + private val url: String? = null, + val description: String? = null, + val background: LOLImage? = null, @SerialName("featured-champions") val champions: List? = null, ) { - override fun toString() = url.substringAfter("/comic/") + override fun toString() = url?.substringAfter("/comic/") ?: error("Empty URL") } @Serializable data class LOLIssues( private val issues: List, -) : Iterable by issues +) : Iterable by issues.reversed() @Serializable data class LOLPages( diff --git a/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLUniverse.kt b/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLUniverse.kt index 0bdfc045f..05dec9faf 100644 --- a/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLUniverse.kt +++ b/src/all/leagueoflegends/src/eu/kanade/tachiyomi/extension/all/leagueoflegends/LOLUniverse.kt @@ -36,10 +36,6 @@ class LOLUniverse( override fun popularMangaRequest(page: Int) = GET("$MEEPS_URL/$siteLang/comics/index.json", headers) - // Request the actual manga URL for the webview - override fun mangaDetailsRequest(manga: SManga) = - GET("$UNIVERSE_URL/$siteLang/comic/${manga.url}") - override fun chapterListRequest(manga: SManga) = GET("$MEEPS_URL/$siteLang/comics/${manga.url}/index.json", headers) @@ -47,11 +43,11 @@ class LOLUniverse( GET("$COMICS_URL/$siteLang/${chapter.url}/index.json", headers) override fun popularMangaParse(response: Response) = - response.decode().map { + response.decode().mapNotNull { SManga.create().apply { - title = it.title + title = it.title ?: return@mapNotNull null url = it.toString() - description = it.description.clean() + description = it.description!!.clean() thumbnail_url = it.background.toString() genre = it.subtitle ?: it.champions?.joinToString() } @@ -60,7 +56,7 @@ class LOLUniverse( override fun chapterListParse(response: Response) = response.decode().map { SChapter.create().apply { - name = it.title + name = it.title!! url = it.toString() chapter_number = it.index ?: -1f fetchPageList() @@ -88,12 +84,21 @@ class LOLUniverse( override fun fetchPageList(chapter: SChapter) = Observable.just(pageCache[chapter.url].orEmpty())!! + override fun getMangaUrl(manga: SManga) = + "$UNIVERSE_URL/$siteLang/comic/${manga.url}" + + override fun getChapterUrl(chapter: SChapter) = + "$UNIVERSE_URL/$siteLang/comic/${chapter.url}" + override fun latestUpdatesRequest(page: Int) = throw UnsupportedOperationException("Not used") override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = throw UnsupportedOperationException("Not used") + override fun mangaDetailsRequest(manga: SManga) = + throw UnsupportedOperationException("Not used") + override fun latestUpdatesParse(response: Response) = throw UnsupportedOperationException("Not used")