League of Legends: fix series list (#15833)

* League of Legends: update for extensions-lib 1.4

* League of Legends: fix series list
This commit is contained in:
ObserverOfTime 2023-04-12 00:31:56 +03:00 committed by GitHub
parent 9f68bdf964
commit a4b8c02799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 15 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'League of Legends' extName = 'League of Legends'
pkgNameSuffix = 'all.leagueoflegends' pkgNameSuffix = 'all.leagueoflegends'
extClass = '.LOLFactory' extClass = '.LOLFactory'
extVersionCode = 1 extVersionCode = 2
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -24,22 +24,22 @@ data class LOLData(
@Serializable @Serializable
data class LOLComic( data class LOLComic(
val title: String, val title: String? = null,
val subtitle: String? = null, val subtitle: String? = null,
val index: Float? = null, val index: Float? = null,
private val url: String, private val url: String? = null,
val description: String, val description: String? = null,
val background: LOLImage, val background: LOLImage? = null,
@SerialName("featured-champions") @SerialName("featured-champions")
val champions: List<LOLChampion>? = null, val champions: List<LOLChampion>? = null,
) { ) {
override fun toString() = url.substringAfter("/comic/") override fun toString() = url?.substringAfter("/comic/") ?: error("Empty URL")
} }
@Serializable @Serializable
data class LOLIssues( data class LOLIssues(
private val issues: List<LOLComic>, private val issues: List<LOLComic>,
) : Iterable<LOLComic> by issues ) : Iterable<LOLComic> by issues.reversed()
@Serializable @Serializable
data class LOLPages( data class LOLPages(

View File

@ -36,10 +36,6 @@ class LOLUniverse(
override fun popularMangaRequest(page: Int) = override fun popularMangaRequest(page: Int) =
GET("$MEEPS_URL/$siteLang/comics/index.json", headers) 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) = override fun chapterListRequest(manga: SManga) =
GET("$MEEPS_URL/$siteLang/comics/${manga.url}/index.json", headers) 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) GET("$COMICS_URL/$siteLang/${chapter.url}/index.json", headers)
override fun popularMangaParse(response: Response) = override fun popularMangaParse(response: Response) =
response.decode<LOLHub>().map { response.decode<LOLHub>().mapNotNull {
SManga.create().apply { SManga.create().apply {
title = it.title title = it.title ?: return@mapNotNull null
url = it.toString() url = it.toString()
description = it.description.clean() description = it.description!!.clean()
thumbnail_url = it.background.toString() thumbnail_url = it.background.toString()
genre = it.subtitle ?: it.champions?.joinToString() genre = it.subtitle ?: it.champions?.joinToString()
} }
@ -60,7 +56,7 @@ class LOLUniverse(
override fun chapterListParse(response: Response) = override fun chapterListParse(response: Response) =
response.decode<LOLIssues>().map { response.decode<LOLIssues>().map {
SChapter.create().apply { SChapter.create().apply {
name = it.title name = it.title!!
url = it.toString() url = it.toString()
chapter_number = it.index ?: -1f chapter_number = it.index ?: -1f
fetchPageList() fetchPageList()
@ -88,12 +84,21 @@ class LOLUniverse(
override fun fetchPageList(chapter: SChapter) = override fun fetchPageList(chapter: SChapter) =
Observable.just(pageCache[chapter.url].orEmpty())!! 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) = override fun latestUpdatesRequest(page: Int) =
throw UnsupportedOperationException("Not used") throw UnsupportedOperationException("Not used")
override fun searchMangaRequest(page: Int, query: String, filters: FilterList) = override fun searchMangaRequest(page: Int, query: String, filters: FilterList) =
throw UnsupportedOperationException("Not used") throw UnsupportedOperationException("Not used")
override fun mangaDetailsRequest(manga: SManga) =
throw UnsupportedOperationException("Not used")
override fun latestUpdatesParse(response: Response) = override fun latestUpdatesParse(response: Response) =
throw UnsupportedOperationException("Not used") throw UnsupportedOperationException("Not used")