update to get thumbnails faster (#211)

This commit is contained in:
Carlos 2018-02-21 11:47:51 -05:00 committed by GitHub
parent 8ab4ab5ad5
commit 649af47d4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

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

View File

@ -60,7 +60,9 @@ open class Mangadex(override val lang: String, private val internalLang: String,
override fun popularMangaFromElement(element: Element): SManga {
val manga = SManga.create()
element.select("a[href*=manga]").first().let {
manga.setUrlWithoutDomain(removeMangaNameFromUrl(it.attr("href")))
val url = removeMangaNameFromUrl(it.attr("href"))
manga.setUrlWithoutDomain(url)
manga.thumbnail_url = baseUrl + "/images" + manga.url.substringBeforeLast("/") + ".jpg"
manga.title = it.text().trim()
manga.author = it?.text()?.trim()
}
@ -158,7 +160,10 @@ open class Mangadex(override val lang: String, private val internalLang: String,
manga.artist = infoElement.select("tr:eq(2) td").first()?.text()
manga.status = parseStatus(infoElement.select("tr:eq(5) td").first()?.text())
manga.description = infoElement.select("tr:eq(7) td").first()?.text()
manga.thumbnail_url = infoElement.select("img").first()?.attr("src").let { baseUrl + "/" + it }
var thumbnail = infoElement.select("img").first()?.attr("src").let { baseUrl + "/" + it }
if (manga.thumbnail_url != thumbnail) {
manga.thumbnail_url = thumbnail
}
var genres = mutableListOf<String>()
genreElement?.forEach { genres.add(it.text()) }
manga.genre = genres.joinToString(", ")