KouhaiWork: update for extensions-lib 1.4 (#15394)

This commit is contained in:
ObserverOfTime 2023-02-18 17:32:02 +02:00 committed by GitHub
parent d239e42d7c
commit ee4b27f60c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 19 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Kouhai Work' extName = 'Kouhai Work'
pkgNameSuffix = 'en.kouhaiwork' pkgNameSuffix = 'en.kouhaiwork'
extClass = '.KouhaiWork' extClass = '.KouhaiWork'
extVersionCode = 7 extVersionCode = 8
} }
apply from: "$rootDir/common.gradle" apply from: "$rootDir/common.gradle"

View File

@ -81,28 +81,25 @@ class KouhaiWork : HttpSource() {
}!! }!!
} }
// Request the actual manga URL for the webview
override fun mangaDetailsRequest(manga: SManga) = override fun mangaDetailsRequest(manga: SManga) =
GET("$baseUrl/series/${manga.url}", headers) GET("$API_URL/manga/get/${manga.url}", headers)
override fun fetchMangaDetails(manga: SManga) = override fun mangaDetailsParse(response: Response) =
client.newCall(chapterListRequest(manga)).asObservableSuccess().map { SManga.create().apply {
val series = it.decode<KouhaiSeriesDetails>() val series = response.decode<KouhaiSeriesDetails>()
manga.description = series.toString() description = series.toString()
manga.author = series.authors?.joinToString() author = series.authors?.joinToString()
manga.artist = series.artists?.joinToString() artist = series.artists?.joinToString()
manga.genre = series.tags.joinToString() genre = series.tags.joinToString()
manga.status = when (series.status) { status = when (series.status) {
"ongoing" -> SManga.ONGOING "ongoing" -> SManga.ONGOING
"finished" -> SManga.COMPLETED "finished" -> SManga.COMPLETED
else -> SManga.UNKNOWN else -> SManga.UNKNOWN
} }
manga.initialized = true initialized = true
return@map manga }
}!!
override fun chapterListRequest(manga: SManga) = override fun chapterListRequest(manga: SManga) = mangaDetailsRequest(manga)
GET("$API_URL/manga/get/${manga.url}", headers)
override fun chapterListParse(response: Response) = override fun chapterListParse(response: Response) =
response.decode<KouhaiSeriesDetails>().chapters.map { response.decode<KouhaiSeriesDetails>().chapters.map {
@ -122,6 +119,10 @@ class KouhaiWork : HttpSource() {
response.decode<KouhaiPages>("chapter") response.decode<KouhaiPages>("chapter")
.mapIndexed { idx, img -> Page(idx, "", img.toString()) } .mapIndexed { idx, img -> Page(idx, "", img.toString()) }
override fun getMangaUrl(manga: SManga) = "$baseUrl/series/${manga.url}"
override fun getChapterUrl(chapter: SChapter) = "$baseUrl/read/${chapter.url}"
override fun getFilterList() = FilterList( override fun getFilterList() = FilterList(
GenresFilter(), GenresFilter(),
ThemesFilter(), ThemesFilter(),
@ -129,9 +130,6 @@ class KouhaiWork : HttpSource() {
StatusFilter(), StatusFilter(),
) )
override fun mangaDetailsParse(response: Response) =
throw UnsupportedOperationException("Not used")
override fun imageUrlParse(response: Response) = override fun imageUrlParse(response: Response) =
throw UnsupportedOperationException("Not used") throw UnsupportedOperationException("Not used")