From cc792ccfb12c9c8625019674f1c3d2e94350ee34 Mon Sep 17 00:00:00 2001 From: e-shl <35057681+e-shl@users.noreply.github.com> Date: Wed, 13 Oct 2021 17:19:16 +0500 Subject: [PATCH] [RU]LibManga fix load cover (#9462) * [RU]LibManga fix load cover * capitalize tag --- src/ru/libmanga/build.gradle | 2 +- .../tachiyomi/extension/ru/libmanga/LibManga.kt | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ru/libmanga/build.gradle b/src/ru/libmanga/build.gradle index 90aa43415..1a0c7f5ea 100644 --- a/src/ru/libmanga/build.gradle +++ b/src/ru/libmanga/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'MangaLib' pkgNameSuffix = 'ru.libmanga' extClass = '.LibManga' - extVersionCode = 54 + extVersionCode = 55 } apply from: "$rootDir/common.gradle" diff --git a/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt b/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt index 2cc6fd33a..855798235 100644 --- a/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt +++ b/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt @@ -87,8 +87,7 @@ class LibManga : ConfigurableSource, HttpSource() { private fun latestUpdatesFromElement(element: Element): SManga { val manga = SManga.create() element.select("div.cover").first().let { img -> - manga.thumbnail_url = baseUrl + img.attr("data-src").substringAfter(baseUrl) - .replace("_thumb", "_250x350") + manga.thumbnail_url = img.attr("data-src").replace("_thumb", "_250x350") } element.select("a").first().let { link -> @@ -149,7 +148,7 @@ class LibManga : ConfigurableSource, HttpSource() { val slug = el["slug"].string val cover = el["cover"].string title = el["name"].string - thumbnail_url = "$baseUrl/uploads/cover/$slug/cover/${cover}_250x350.jpg" + thumbnail_url = "$COVER_URL/uploads/cover/$slug/cover/${cover}_250x350.jpg" url = "/$slug" } @@ -164,9 +163,9 @@ class LibManga : ConfigurableSource, HttpSource() { val body = document.select("div.media-info-list").first() val rawCategory = body.select("div.media-info-list__title:contains(Тип) + div").text() val category = when { - rawCategory == "Комикс западный" -> "комикс" - rawCategory.isNotBlank() -> rawCategory.toLowerCase(Locale.ROOT) - else -> "манга" + rawCategory == "Комикс западный" -> "Комикс" + rawCategory.isNotBlank() -> rawCategory + else -> "Манга" } var rawAgeStop = body.select("div.media-info-list__title:contains(Возрастной рейтинг) + div").text() if (rawAgeStop.isEmpty()) { @@ -188,7 +187,7 @@ class LibManga : ConfigurableSource, HttpSource() { ratingValue > 0.5 -> "✬☆☆☆☆" else -> "☆☆☆☆☆" } - val genres = document.select(".media-tags > a").map { it.text() } + val genres = document.select(".media-tags > a").map { it.text().capitalize() } manga.title = document.select(".media-name__alt").text() manga.thumbnail_url = document.select(".media-sidebar__cover > img").attr("src").substringAfter(baseOrig) manga.author = body.select("div.media-info-list__title:contains(Автор) + div").text() @@ -778,6 +777,8 @@ class LibManga : ConfigurableSource, HttpSource() { private const val DOMAIN_PREF = "MangaLibDomain" private const val DOMAIN_PREF_Title = "Выбор домена" + + private const val COVER_URL = "https://staticlib.me" } private var server: String? = preferences.getString(SERVER_PREF, null)