From 9b1efb4a7ea3928ae2a2636b7b0b577257b22077 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 19 Apr 2018 11:05:36 -0400 Subject: [PATCH] mangadex: change cover logic (#305) --- src/all/mangadex/build.gradle | 4 ++-- .../tachiyomi/extension/all/mangadex/Mangadex.kt | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/all/mangadex/build.gradle b/src/all/mangadex/build.gradle index 7a8b83f5d..ea6141d78 100644 --- a/src/all/mangadex/build.gradle +++ b/src/all/mangadex/build.gradle @@ -5,8 +5,8 @@ ext { appName = 'Tachiyomi: MangaDex' pkgNameSuffix = "all.mangadex" extClass = '.MangadexFactory' - extVersionCode = 20 - extVersionSuffix = 20 + extVersionCode = 21 + extVersionSuffix = 21 libVersion = '1.2' } diff --git a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt index 94c233fd0..83de70323 100644 --- a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt +++ b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt @@ -19,7 +19,7 @@ import java.net.URLEncoder import java.util.* 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" @@ -67,10 +67,12 @@ open class Mangadex(override val lang: String, private val internalLang: String, override fun popularMangaFromElement(element: Element): SManga { 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 { 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() } @@ -84,6 +86,7 @@ open class Mangadex(override val lang: String, private val internalLang: String, element.let { manga.setUrlWithoutDomain(removeMangaNameFromUrl(it.attr("href"))) manga.title = it.text().trim() + } return manga } @@ -149,10 +152,12 @@ open class Mangadex(override val lang: String, private val internalLang: String, override fun searchMangaFromElement(element: Element): SManga { 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 { 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() }