Split out Mangadex thumbnail changes from PR #887
This commit is contained in:
parent
0c3c3a938a
commit
0bf9f6e37c
|
@ -5,7 +5,7 @@ ext {
|
|||
appName = 'Tachiyomi: MangaDex'
|
||||
pkgNameSuffix = 'all.mangadex'
|
||||
extClass = '.MangadexFactory'
|
||||
extVersionCode = 52
|
||||
extVersionCode = 53
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -86,15 +86,21 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
|||
manga.setUrlWithoutDomain(url)
|
||||
manga.title = it.text().trim()
|
||||
}
|
||||
if (getShowThumbnail() == LOW_QUALITY) {
|
||||
manga.thumbnail_url = formThumbUrl(manga.url)
|
||||
}
|
||||
return manga
|
||||
}
|
||||
|
||||
private fun modifyMangaUrl(url: String): String = url.replace("/title/", "/manga/").substringBeforeLast("/") + "/"
|
||||
|
||||
private fun formThumbUrl(mangaUrl: String): String = cdnUrl + "/images/manga/" + getMangaId(mangaUrl) +".thumb.jpg"
|
||||
private fun formThumbUrl(mangaUrl: String): String {
|
||||
var ext = ".jpg"
|
||||
|
||||
if (getShowThumbnail() == LOW_QUALITY) {
|
||||
ext = ".thumb$ext"
|
||||
}
|
||||
|
||||
return cdnUrl + "/images/manga/" + getMangaId(mangaUrl) + ext
|
||||
}
|
||||
|
||||
override fun latestUpdatesFromElement(element: Element): SManga {
|
||||
val manga = SManga.create()
|
||||
|
@ -103,9 +109,7 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
|||
manga.title = it.text().trim()
|
||||
|
||||
}
|
||||
if (getShowThumbnail() == LOW_QUALITY) {
|
||||
manga.thumbnail_url = formThumbUrl(manga.url)
|
||||
}
|
||||
|
||||
return manga
|
||||
}
|
||||
|
@ -272,9 +276,7 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
|||
manga.title = it.text().trim()
|
||||
}
|
||||
|
||||
if (getShowThumbnail() == LOW_QUALITY) {
|
||||
manga.thumbnail_url = formThumbUrl(manga.url)
|
||||
}
|
||||
|
||||
return manga
|
||||
}
|
||||
|
@ -493,8 +495,6 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
|||
}
|
||||
val thumbsPref = ListPreference(screen.context).apply {
|
||||
key = SHOW_THUMBNAIL_PREF_Title
|
||||
title = SHOW_THUMBNAIL_PREF_Title
|
||||
|
||||
title = SHOW_THUMBNAIL_PREF_Title
|
||||
entries = arrayOf("Show high quality", "Show low quality")
|
||||
entryValues = arrayOf("0", "1")
|
||||
|
@ -652,7 +652,6 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
|||
private const val SHOW_R18_PREF_Title = "Default R18 Setting"
|
||||
private const val SHOW_R18_PREF = "showR18Default"
|
||||
|
||||
private const val HIGH_QUALITY = 0
|
||||
private const val LOW_QUALITY = 1
|
||||
|
||||
private const val SHOW_THUMBNAIL_PREF_Title = "Default thumbnail quality"
|
||||
|
|
Loading…
Reference in New Issue