Update common dependencies (#441)

Update common dependencies
This commit is contained in:
Eugene
2018-08-05 16:48:02 -04:00
committed by Carlos
parent 83a82e1181
commit d2f6744188
18 changed files with 39 additions and 43 deletions

View File

@ -276,7 +276,7 @@ open class Mangadex(override val lang: String, private val internalLang: String,
private fun isMangaCompleted(finalChapterNumber: String, chapterJson: JsonObject): Boolean {
val count = chapterJson.entrySet()
.filter { it -> it.value.asJsonObject.get("lang_code").string == internalLang }
.filter { it -> doesFinalChapterExist(finalChapterNumber, it.value) }?.count()
.filter { it -> doesFinalChapterExist(finalChapterNumber, it.value) }.count()
return when (count) {
0 -> false
else -> true
@ -352,8 +352,6 @@ open class Mangadex(override val lang: String, private val internalLang: String,
override fun pageListParse(document: Document): List<Page> {
val pages = mutableListOf<Page>()
val url = document.baseUri()
val dataUrl = document.select("script").last().html().substringAfter("dataurl = '").substringBefore("';")
val imageUrl = document.select("script").last().html().substringAfter("page_array = [").substringBefore("];")
val listImageUrls = imageUrl.replace("'", "").split(",")
@ -474,4 +472,4 @@ open class Mangadex(override val lang: String, private val internalLang: String,
private const val BASE_CHAPTER = "/chapter/"
}
}
}

View File

@ -40,7 +40,7 @@ open class MyReadingManga(override val lang: String) : ParsedHttpSource() {
}
}
val hasNextPage = popularMangaNextPageSelector()?.let { selector ->
val hasNextPage = popularMangaNextPageSelector().let { selector ->
document.select(selector).first()
} != null

View File

@ -55,7 +55,7 @@ open class NHentai(override val lang: String, val nhLang: String) : HttpSource()
= throw UnsupportedOperationException("This method should not be called!")
override fun mangaDetailsParse(response: Response)
= parseGallery(jsonParser.parse(response.body().string()).obj)
= parseGallery(jsonParser.parse(response.body()!!.string()).obj)
//Hack so we can use a different URL for fetching manga details and opening the details in the browser
override fun fetchMangaDetails(manga: SManga)
@ -70,7 +70,7 @@ open class NHentai(override val lang: String, val nhLang: String) : HttpSource()
fun urlToDetailsRequest(url: String) = nhGet("$baseUrl/api/gallery/${url.substringAfterLast('/')}")
fun parseResultPage(response: Response): MangasPage {
val res = jsonParser.parse(response.body().string()).obj
val res = jsonParser.parse(response.body()!!.string()).obj
res["error"]?.let {
throw RuntimeException("An error occurred while performing the search: $it")
@ -120,7 +120,7 @@ open class NHentai(override val lang: String, val nhLang: String) : HttpSource()
tags.clear()
}?.forEach {
if (it.first != null && it.second != null)
tags.getOrPut(it.first!!, { mutableListOf<Tag>() }).add(Tag(it.second!!, false))
tags.getOrPut(it.first!!) { mutableListOf() }.add(Tag(it.second!!, false))
}!!
}
@ -132,7 +132,7 @@ open class NHentai(override val lang: String, val nhLang: String) : HttpSource()
client.newCall(urlToDetailsRequest(url))
.asObservableSuccess()
.map {
rawParseGallery(jsonParser.parse(it.body().string()).obj)
rawParseGallery(jsonParser.parse(it.body()!!.string()).obj)
}!!
override fun fetchChapterList(manga: SManga)