fix Hitomi method conflict with ext-lib 1.5 methods (#806)
* maybe fix private fun conflict with ext-lib 1.5 interface methods * add pages in description * slight refactor * bump * make search default order same as site some entries don't show up on popular sort
This commit is contained in:
parent
46c51293c7
commit
9f21ec0d06
|
@ -1,7 +1,7 @@
|
||||||
ext {
|
ext {
|
||||||
extName = 'Hitomi'
|
extName = 'Hitomi'
|
||||||
extClass = '.HitomiFactory'
|
extClass = '.HitomiFactory'
|
||||||
extVersionCode = 25
|
extVersionCode = 26
|
||||||
isNsfw = true
|
isNsfw = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,38 +56,31 @@ class Hitomi(
|
||||||
.set("origin", baseUrl)
|
.set("origin", baseUrl)
|
||||||
|
|
||||||
override fun fetchPopularManga(page: Int): Observable<MangasPage> = Observable.fromCallable {
|
override fun fetchPopularManga(page: Int): Observable<MangasPage> = Observable.fromCallable {
|
||||||
runBlocking { getPopularManga(page) }
|
runBlocking {
|
||||||
}
|
|
||||||
|
|
||||||
private suspend fun getPopularManga(page: Int): MangasPage {
|
|
||||||
val entries = getGalleryIDsFromNozomi("popular", "today", nozomiLang, page.nextPageRange())
|
val entries = getGalleryIDsFromNozomi("popular", "today", nozomiLang, page.nextPageRange())
|
||||||
.toMangaList()
|
.toMangaList()
|
||||||
|
|
||||||
return MangasPage(entries, entries.size >= 24)
|
MangasPage(entries, entries.size >= 24)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun fetchLatestUpdates(page: Int): Observable<MangasPage> = Observable.fromCallable {
|
override fun fetchLatestUpdates(page: Int): Observable<MangasPage> = Observable.fromCallable {
|
||||||
runBlocking { getLatestUpdates(page) }
|
runBlocking {
|
||||||
}
|
|
||||||
|
|
||||||
private suspend fun getLatestUpdates(page: Int): MangasPage {
|
|
||||||
val entries = getGalleryIDsFromNozomi(null, "index", nozomiLang, page.nextPageRange())
|
val entries = getGalleryIDsFromNozomi(null, "index", nozomiLang, page.nextPageRange())
|
||||||
.toMangaList()
|
.toMangaList()
|
||||||
|
|
||||||
return MangasPage(entries, entries.size >= 24)
|
MangasPage(entries, entries.size >= 24)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private lateinit var searchResponse: List<Int>
|
private lateinit var searchResponse: List<Int>
|
||||||
|
|
||||||
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> = Observable.fromCallable {
|
override fun fetchSearchManga(page: Int, query: String, filters: FilterList): Observable<MangasPage> = Observable.fromCallable {
|
||||||
runBlocking { getSearchManga(page, query, filters) }
|
runBlocking {
|
||||||
}
|
|
||||||
|
|
||||||
private suspend fun getSearchManga(page: Int, query: String, filters: FilterList): MangasPage {
|
|
||||||
if (page == 1) {
|
if (page == 1) {
|
||||||
searchResponse = hitomiSearch(
|
searchResponse = hitomiSearch(
|
||||||
query.trim(),
|
query.trim(),
|
||||||
filters.filterIsInstance<SortFilter>().firstOrNull()?.state == 0,
|
filters.filterIsInstance<SortFilter>().firstOrNull()?.state == 1,
|
||||||
nozomiLang,
|
nozomiLang,
|
||||||
).toList()
|
).toList()
|
||||||
}
|
}
|
||||||
|
@ -96,10 +89,11 @@ class Hitomi(
|
||||||
val entries = searchResponse.subList((page - 1) * 25, end)
|
val entries = searchResponse.subList((page - 1) * 25, end)
|
||||||
.toMangaList()
|
.toMangaList()
|
||||||
|
|
||||||
return MangasPage(entries, end != searchResponse.size)
|
MangasPage(entries, end != searchResponse.size)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SortFilter : Filter.Select<String>("Sort By", arrayOf("Popularity", "Updated"))
|
private class SortFilter : Filter.Select<String>("Sort By", arrayOf("Updated", "Popularity"))
|
||||||
|
|
||||||
override fun getFilterList(): FilterList {
|
override fun getFilterList(): FilterList {
|
||||||
return FilterList(SortFilter())
|
return FilterList(SortFilter())
|
||||||
|
@ -450,6 +444,7 @@ class Hitomi(
|
||||||
parodys?.joinToString { it.formatted }?.let {
|
parodys?.joinToString { it.formatted }?.let {
|
||||||
append("Parodies: ", it, "\n")
|
append("Parodies: ", it, "\n")
|
||||||
}
|
}
|
||||||
|
append("Pages: ", files.size)
|
||||||
}
|
}
|
||||||
status = SManga.COMPLETED
|
status = SManga.COMPLETED
|
||||||
update_strategy = UpdateStrategy.ONLY_FETCH_ONCE
|
update_strategy = UpdateStrategy.ONLY_FETCH_ONCE
|
||||||
|
@ -464,10 +459,8 @@ class Hitomi(
|
||||||
return GET("$ltnUrl/galleries/$id.js", headers)
|
return GET("$ltnUrl/galleries/$id.js", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun mangaDetailsParse(response: Response): SManga {
|
override fun mangaDetailsParse(response: Response) = runBlocking {
|
||||||
return response.parseScriptAs<Gallery>().let {
|
response.parseScriptAs<Gallery>().toSManga()
|
||||||
runBlocking { it.toSManga() }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getMangaUrl(manga: SManga) = baseUrl + manga.url
|
override fun getMangaUrl(manga: SManga) = baseUrl + manga.url
|
||||||
|
@ -508,11 +501,10 @@ class Hitomi(
|
||||||
return GET("$ltnUrl/galleries/$id.js", headers)
|
return GET("$ltnUrl/galleries/$id.js", headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun pageListParse(response: Response): List<Page> {
|
override fun pageListParse(response: Response) = runBlocking {
|
||||||
val gallery = response.parseScriptAs<Gallery>()
|
val gallery = response.parseScriptAs<Gallery>()
|
||||||
|
|
||||||
return gallery.files.mapIndexed { idx, img ->
|
gallery.files.mapIndexed { idx, img ->
|
||||||
runBlocking {
|
|
||||||
val hash = img.hash
|
val hash = img.hash
|
||||||
val commonId = commonImageId()
|
val commonId = commonImageId()
|
||||||
val imageId = imageIdFromHash(hash)
|
val imageId = imageIdFromHash(hash)
|
||||||
|
@ -525,7 +517,6 @@ class Hitomi(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun imageRequest(page: Page): Request {
|
override fun imageRequest(page: Page): Request {
|
||||||
val imageHeaders = headersBuilder()
|
val imageHeaders = headersBuilder()
|
||||||
|
|
Loading…
Reference in New Issue