mangadex: change cover logic (#305)

This commit is contained in:
Carlos 2018-04-19 11:05:36 -04:00 committed by GitHub
parent d9f31622f2
commit 9b1efb4a7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -5,8 +5,8 @@ ext {
appName = 'Tachiyomi: MangaDex' appName = 'Tachiyomi: MangaDex'
pkgNameSuffix = "all.mangadex" pkgNameSuffix = "all.mangadex"
extClass = '.MangadexFactory' extClass = '.MangadexFactory'
extVersionCode = 20 extVersionCode = 21
extVersionSuffix = 20 extVersionSuffix = 21
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -19,7 +19,7 @@ import java.net.URLEncoder
import java.util.* import java.util.*
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
open class Mangadex(override val lang: String, private val internalLang: String, val langCode: Int) : ParsedHttpSource() { open class Mangadex(override val lang: String, private val internalLang: String, private val langCode: Int) : ParsedHttpSource() {
override val name = "MangaDex" override val name = "MangaDex"
@ -67,10 +67,12 @@ open class Mangadex(override val lang: String, private val internalLang: String,
override fun popularMangaFromElement(element: Element): SManga { override fun popularMangaFromElement(element: Element): SManga {
val manga = SManga.create() val manga = SManga.create()
element.select("div.large_logo img").first().let {
manga.thumbnail_url = baseUrl + it.attr("src")
}
element.select("a.manga_title").first().let { element.select("a.manga_title").first().let {
val url = removeMangaNameFromUrl(it.attr("href")) val url = removeMangaNameFromUrl(it.attr("href"))
manga.setUrlWithoutDomain(url) manga.setUrlWithoutDomain(url)
manga.thumbnail_url = baseUrl + "/images" + manga.url.substringBeforeLast("/") + ".jpg"
manga.title = it.text().trim() manga.title = it.text().trim()
manga.author = it?.text()?.trim() manga.author = it?.text()?.trim()
} }
@ -84,6 +86,7 @@ open class Mangadex(override val lang: String, private val internalLang: String,
element.let { element.let {
manga.setUrlWithoutDomain(removeMangaNameFromUrl(it.attr("href"))) manga.setUrlWithoutDomain(removeMangaNameFromUrl(it.attr("href")))
manga.title = it.text().trim() manga.title = it.text().trim()
} }
return manga return manga
} }
@ -149,10 +152,12 @@ open class Mangadex(override val lang: String, private val internalLang: String,
override fun searchMangaFromElement(element: Element): SManga { override fun searchMangaFromElement(element: Element): SManga {
val manga = SManga.create() val manga = SManga.create()
element.select("div.large_logo img").first().let {
manga.thumbnail_url = baseUrl + it.attr("src")
}
element.select("a.manga_title").first().let { element.select("a.manga_title").first().let {
val url = removeMangaNameFromUrl(it.attr("href")) val url = removeMangaNameFromUrl(it.attr("href"))
manga.setUrlWithoutDomain(url) manga.setUrlWithoutDomain(url)
manga.thumbnail_url = baseUrl + "/images" + manga.url.substringBeforeLast("/") + ".jpg"
manga.title = it.text().trim() manga.title = it.text().trim()
manga.author = it?.text()?.trim() manga.author = it?.text()?.trim()
} }