Fix EHentai Syncing a bit
This commit is contained in:
parent
32197b1491
commit
ba9db7ceb9
@ -46,6 +46,7 @@ import exh.ui.metadata.adapters.EHentaiDescriptionAdapter
|
|||||||
import exh.util.UriFilter
|
import exh.util.UriFilter
|
||||||
import exh.util.UriGroup
|
import exh.util.UriGroup
|
||||||
import exh.util.asObservableWithAsyncStacktrace
|
import exh.util.asObservableWithAsyncStacktrace
|
||||||
|
import exh.util.awaitResponse
|
||||||
import exh.util.dropBlank
|
import exh.util.dropBlank
|
||||||
import exh.util.ignore
|
import exh.util.ignore
|
||||||
import exh.util.nullIfBlank
|
import exh.util.nullIfBlank
|
||||||
@ -360,11 +361,17 @@ class EHentai(
|
|||||||
getChapterList(manga.toMangaInfo(), throttleFunc).map { it.toSChapter() }
|
getChapterList(manga.toMangaInfo(), throttleFunc).map { it.toSChapter() }
|
||||||
})
|
})
|
||||||
|
|
||||||
override fun fetchPageList(chapter: SChapter) = fetchChapterPage(chapter, baseUrl + chapter.url).map {
|
override fun fetchPageList(chapter: SChapter) = fetchChapterPage(chapter, baseUrl + chapter.url)
|
||||||
it.mapIndexed { i, s ->
|
.map {
|
||||||
Page(i, s)
|
it.mapIndexed { i, s ->
|
||||||
|
Page(i, s)
|
||||||
|
}
|
||||||
|
}!!
|
||||||
|
.doOnNext { pages ->
|
||||||
|
if (pages.any { it.url == "https://$domain/img/509.gif" }) throw Exception(
|
||||||
|
"Hit page limit"
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}!!.doOnNext { pages -> if (pages.any { it.url == "https://$domain/img/509.gif" }) throw Exception("Hit page limit") }
|
|
||||||
|
|
||||||
private fun fetchChapterPage(
|
private fun fetchChapterPage(
|
||||||
chapter: SChapter,
|
chapter: SChapter,
|
||||||
@ -459,23 +466,23 @@ class EHentai(
|
|||||||
|
|
||||||
private fun exGet(url: String, page: Int? = null, additionalHeaders: Headers? = null, cache: Boolean = true): Request {
|
private fun exGet(url: String, page: Int? = null, additionalHeaders: Headers? = null, cache: Boolean = true): Request {
|
||||||
return GET(
|
return GET(
|
||||||
page?.let {
|
if (page != null) {
|
||||||
addParam(url, "page", (page - 1).toString())
|
addParam(url, "page", (page - 1).toString())
|
||||||
} ?: url,
|
} else url,
|
||||||
additionalHeaders?.let { additionalHeadersNotNull ->
|
if (additionalHeaders != null) {
|
||||||
val headers = headers.newBuilder()
|
val headers = headers.newBuilder()
|
||||||
additionalHeadersNotNull.toMultimap().forEach { (t, u) ->
|
additionalHeaders.toMultimap().forEach { (t, u) ->
|
||||||
u.forEach {
|
u.forEach {
|
||||||
headers.add(t, it)
|
headers.add(t, it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
headers.build()
|
headers.build()
|
||||||
} ?: headers
|
} else headers
|
||||||
).let {
|
).let {
|
||||||
if (!cache) {
|
if (cache) {
|
||||||
it.newBuilder().cacheControl(CacheControl.FORCE_NETWORK).build()
|
|
||||||
} else {
|
|
||||||
it
|
it
|
||||||
|
} else {
|
||||||
|
it.newBuilder().cacheControl(CacheControl.FORCE_NETWORK).build()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -523,7 +530,7 @@ class EHentai(
|
|||||||
|
|
||||||
override suspend fun getMangaDetails(manga: MangaInfo): MangaInfo {
|
override suspend fun getMangaDetails(manga: MangaInfo): MangaInfo {
|
||||||
val exception = Exception("Async stacktrace")
|
val exception = Exception("Async stacktrace")
|
||||||
val response = client.newCall(mangaDetailsRequest(manga.toSManga())).await()
|
val response = client.newCall(mangaDetailsRequest(manga.toSManga())).awaitResponse()
|
||||||
if (response.isSuccessful) {
|
if (response.isSuccessful) {
|
||||||
// Pull to most recent
|
// Pull to most recent
|
||||||
val doc = response.asJsoup()
|
val doc = response.asJsoup()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user