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(",")

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(", ")

View File

@ -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)))

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

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()

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

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

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)
}

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

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

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

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