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

@ -45,9 +45,9 @@ repositories {
}
dependencies {
compileOnly "eu.kanade.tachiyomi:extensions-library:$libVersion"
compileOnly 'com.squareup.okhttp3:okhttp:3.5.0'
compileOnly 'io.reactivex:rxjava:1.2.4'
compileOnly 'org.jsoup:jsoup:1.10.1'
compileOnly "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compileOnly "eu.kanade.tachiyomi:extensions-library:$libVersion"
compileOnly 'com.squareup.okhttp3:okhttp:3.10.0'
compileOnly 'io.reactivex:rxjava:1.3.6'
compileOnly 'org.jsoup:jsoup:1.10.2'
}

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)

View File

@ -106,8 +106,8 @@ abstract class DynastyScans : ParsedHttpSource() {
protected fun parseGenres(elements: Elements, manga: SManga) {
if (!elements.isEmpty()) {
var genres = mutableListOf<String>()
elements?.forEach {
val genres = mutableListOf<String>()
elements.forEach {
genres.add(it.text())
}
manga.genre = genres.joinToString(", ")
@ -233,4 +233,4 @@ abstract class DynastyScans : ParsedHttpSource() {
return popularMangaRequest(page)
}
}
}

View File

@ -90,7 +90,7 @@ class Hentai2Read : ParsedHttpSource() {
is ReleaseYearSelect -> add("cbo_wpm_pag_mng_sch_rls_yer", filter.state.toString())
is Status -> add("rad_wpm_pag_mng_sch_sts", filter.state.toString())
is TagSearchMode -> add("rad_wpm_pag_mng_sch_tag_mde", arrayOf("and", "or")[filter.state])
is TagList -> filter.state.forEach { tag ->
is TagList -> filter.state.forEach { tag ->
when (tag.state) {
Filter.TriState.STATE_INCLUDE -> add("chk_wpm_pag_mng_sch_mng_tag_inc[]", tag.id.toString())
Filter.TriState.STATE_EXCLUDE -> add("chk_wpm_pag_mng_sch_mng_tag_exc[]", tag.id.toString())
@ -194,7 +194,7 @@ class Hentai2Read : ParsedHttpSource() {
override fun pageListParse(response: Response): List<Page> {
val pages = mutableListOf<Page>()
val m = pagesUrlPattern.matcher(response.body().string())
val m = pagesUrlPattern.matcher(response.body()!!.string())
var i = 0
while (m.find()) {
m.group(1).split(",").forEach {

View File

@ -145,7 +145,7 @@ class Mangacow : ParsedHttpSource() {
override fun pageListParse(response: Response): List<Page> {
val pages = mutableListOf<Page>()
val m = pagesUrlPattern.matcher(response.body().string())
val m = pagesUrlPattern.matcher(response.body()!!.string())
var i = 0
while (m.find()) {
pages.add(Page(i++, "", m.group(1)))
@ -162,4 +162,4 @@ class Mangacow : ParsedHttpSource() {
override fun imageUrlParse(document: Document) = ""
override fun getFilterList() = FilterList()
}
}

View File

@ -38,7 +38,7 @@ class Mangaeden : ParsedHttpSource() {
override fun popularMangaNextPageSelector() = searchMangaNextPageSelector()
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = HttpUrl.parse("$baseUrl/en/en-directory/").newBuilder().addQueryParameter("title", query)
val url = HttpUrl.parse("$baseUrl/en/en-directory/")?.newBuilder()!!.addQueryParameter("title", query)
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) {
is StatusList -> filter.state
@ -200,4 +200,4 @@ class Mangaeden : ParsedHttpSource() {
Genre("Yaoi", "4e70e91ac092255ef70016e5"),
Genre("Yuri", "4e70e92ac092255ef7001a57")
)
}
}

View File

@ -58,8 +58,7 @@ class Mangazuki : ParsedHttpSource() {
override fun latestUpdatesNextPageSelector() = null
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = HttpUrl.parse("$baseUrl/manga-list").newBuilder()
val url = HttpUrl.parse("$baseUrl/manga-list")?.newBuilder()!!
return GET(url.toString(), headers)
}
override fun searchMangaSelector() = popularMangaSelector()
@ -129,4 +128,4 @@ class Mangazuki : ParsedHttpSource() {
override fun pageListParse(document: Document) = document.select("div#all > img").mapIndexed { i, element -> Page(i, "", element.attr("data-src")) }
override fun imageUrlParse(document: Document) = ""
}
}

View File

@ -38,7 +38,7 @@ class Perveden : ParsedHttpSource() {
override fun popularMangaNextPageSelector() = searchMangaNextPageSelector()
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = HttpUrl.parse("$baseUrl/en/en-directory/").newBuilder().addQueryParameter("title", query)
val url = HttpUrl.parse("$baseUrl/en/en-directory/")?.newBuilder()!!.addQueryParameter("title", query)
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) {
is StatusList -> filter.state
@ -1329,4 +1329,4 @@ class Perveden : ParsedHttpSource() {
Pair("zero gravity", "5619c9b2719a16502106c0b2"),
Pair("zooey", "5875fb34719a16738b9f43ac")
)
}
}

View File

@ -116,7 +116,7 @@ class Readcomiconline : ParsedHttpSource() {
val pages = mutableListOf<Page>()
//language=RegExp
val p = Pattern.compile("""lstImages.push\("(.+?)"""")
val m = p.matcher(response.body().string())
val m = p.matcher(response.body()!!.string())
var i = 0
while (m.find()) {

View File

@ -127,7 +127,7 @@ class ShoujoSense : ParsedHttpSource() {
override fun pageListRequest(chapter: SChapter) = POST(baseUrl + chapter.url, headers)
override fun pageListParse(response: Response): List<Page> {
val body = response.body().string()
val body = response.body()!!.string()
val pages = mutableListOf<Page>()
val p = pagesUrlPattern
@ -148,4 +148,4 @@ class ShoujoSense : ParsedHttpSource() {
override fun imageUrlRequest(page: Page) = GET(page.url)
override fun imageUrlParse(document: Document) = ""
}
}

View File

@ -78,8 +78,7 @@ class Webtoons : ParsedHttpSource() {
override fun latestUpdatesNextPageSelector() = null
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = HttpUrl.parse("$baseUrl/search?keyword=$query").newBuilder()
val url = HttpUrl.parse("$baseUrl/search?keyword=$query")?.newBuilder()!!
url.addQueryParameter("searchType", "WEBTOON")
return GET(url.toString(), headers)
}
@ -157,4 +156,4 @@ class Webtoons : ParsedHttpSource() {
override fun pageListParse(document: Document) = document.select("div#_imageList > img").mapIndexed { i, element -> Page(i, "", element.attr("data-url")) }
override fun imageUrlParse(document: Document) = document.select("img").first().attr("src")
}
}

View File

@ -160,7 +160,7 @@ class HentaiFantasy : ParsedHttpSource() {
override fun pageListRequest(chapter: SChapter) = POST(baseUrl + chapter.url, headers)
override fun pageListParse(response: Response): List<Page> {
val body = response.body().string()
val body = response.body()!!.string()
val pages = mutableListOf<Page>()
val p = pagesUrlPattern
@ -239,4 +239,4 @@ class HentaiFantasy : ParsedHttpSource() {
Tag("Yaoi", 22),
Tag("Yuri", 14)
)
}
}

View File

@ -38,7 +38,7 @@ class Mangaeden : ParsedHttpSource() {
override fun popularMangaNextPageSelector() = searchMangaNextPageSelector()
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = HttpUrl.parse("$baseUrl/it/it-directory/").newBuilder().addQueryParameter("title", query)
val url = HttpUrl.parse("$baseUrl/it/it-directory/")?.newBuilder()!!.addQueryParameter("title", query)
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) {
is StatusList -> filter.state
@ -201,4 +201,4 @@ class Mangaeden : ParsedHttpSource() {
Genre("Yaoi", "4e70ea8cc092255ef70073de"),
Genre("Yuri", "4e70ea9ac092255ef70075d1")
)
}
}

View File

@ -38,7 +38,7 @@ class Perveden : ParsedHttpSource() {
override fun popularMangaNextPageSelector() = searchMangaNextPageSelector()
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = HttpUrl.parse("$baseUrl/it/it-directory/").newBuilder().addQueryParameter("title", query)
val url = HttpUrl.parse("$baseUrl/it/it-directory/")?.newBuilder()!!.addQueryParameter("title", query)
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
when (filter) {
is StatusList -> filter.state
@ -397,4 +397,4 @@ class Perveden : ParsedHttpSource() {
Pair("yandere", "577e7295719a168ef96a79e7"),
Pair("yuri", "577e6f90719a168e7d256a4c")
)
}
}

View File

@ -126,7 +126,7 @@ class UnionMangas : ParsedHttpSource() {
}
private fun removeLabel(text: String?): String {
return text!!.substring(text!!.indexOf(":") + 1)
return text!!.substring(text.indexOf(":") + 1)
}
override fun chapterListSelector() = "div.row.lancamento-linha"

View File

@ -39,7 +39,7 @@ class Truyentranhlh : HttpSource() {
popularMangaFromElement(element)
}
val hasNextPage = popularMangaNextPageSelector()?.let { selector ->
val hasNextPage = popularMangaNextPageSelector().let { selector ->
document.select(selector).first()
} != null
@ -58,7 +58,7 @@ class Truyentranhlh : HttpSource() {
latestUpdatesFromElement(element)
}
val hasNextPage = latestUpdatesNextPageSelector()?.let { selector ->
val hasNextPage = latestUpdatesNextPageSelector().let { selector ->
document.select(selector).first()
} != null
@ -188,4 +188,4 @@ class Truyentranhlh : HttpSource() {
override fun imageUrlParse(response: Response): String {
return ""
}
}
}