[RU]Libmanga & Libhentai fix "changing cover language" (#10773)
(non-profile display during the first installation)
This commit is contained in:
parent
b71aef51cb
commit
3ac572f57e
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'HentaiLib'
|
||||
pkgNameSuffix = 'ru.libhentai'
|
||||
extClass = '.LibHentai'
|
||||
extVersionCode = 4
|
||||
extVersionCode = 5
|
||||
isNsfw = true
|
||||
}
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
|
||||
element.select("a").first().let { link ->
|
||||
manga.setUrlWithoutDomain(link.attr("href"))
|
||||
manga.title = if (preferences.getString(LANGUAGE_PREF, "rus").equals("rus") || element.select(".updates__name_rus").isNullOrEmpty()) { element.select("h4").first().text() } else element.select(".updates__name_rus").first().text()
|
||||
manga.title = if (isEng.equals("rus") || element.select(".updates__name_rus").isNullOrEmpty()) { element.select("h4").first().text() } else element.select(".updates__name_rus").first().text()
|
||||
}
|
||||
return manga
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
private fun popularMangaFromElement(el: JsonElement) = SManga.create().apply {
|
||||
val slug = el.jsonObject["slug"]!!.jsonPrimitive.content
|
||||
val cover = el.jsonObject["cover"]!!.jsonPrimitive.content
|
||||
title = if (preferences.getString(LANGUAGE_PREF, "rus").equals("rus")) el.jsonObject["rus_name"]!!.jsonPrimitive.content else el.jsonObject["name"]!!.jsonPrimitive.content
|
||||
title = if (isEng.equals("rus")) el.jsonObject["rus_name"]!!.jsonPrimitive.content else el.jsonObject["name"]!!.jsonPrimitive.content
|
||||
thumbnail_url = "$COVER_URL/huploads/cover/$slug/cover/${cover}_250x350.jpg"
|
||||
url = "/$slug"
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
else -> "☆☆☆☆☆"
|
||||
}
|
||||
val genres = document.select(".media-tags > a").map { it.text().capitalize() }
|
||||
manga.title = if (preferences.getString(LANGUAGE_PREF, "rus").equals("rus")) document.select(".media-name__main").text() else document.select(".media-name__alt").text()
|
||||
manga.title = if (isEng.equals("rus")) document.select(".media-name__main").text() else document.select(".media-name__alt").text()
|
||||
manga.thumbnail_url = document.select(".media-sidebar__cover > img").attr("src")
|
||||
manga.author = body.select("div.media-info-list__title:contains(Автор) + div").text()
|
||||
manga.artist = body.select("div.media-info-list__title:contains(Художник) + div").text()
|
||||
|
@ -204,13 +204,13 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
"завершен" -> SManga.COMPLETED
|
||||
else -> SManga.UNKNOWN
|
||||
}
|
||||
manga.genre = genres.plusElement(category).plusElement(rawAgeStop).joinToString { it.trim() }
|
||||
manga.genre = category + ", " + rawAgeStop + ", " + genres.joinToString { it.trim() }
|
||||
val altSelector = document.select(".media-info-list__item_alt-names .media-info-list__value div")
|
||||
var altName = ""
|
||||
if (altSelector.isNotEmpty()) {
|
||||
altName = "Альтернативные названия:\n" + altSelector.map { it.text() }.joinToString(" / ") + "\n\n"
|
||||
}
|
||||
val mediaNameLanguage = if (preferences.getString(LANGUAGE_PREF, "rus").equals("rus")) document.select(".media-name__alt").text() else document.select(".media-name__main").text()
|
||||
val mediaNameLanguage = if (isEng.equals("rus")) document.select(".media-name__alt").text() else document.select(".media-name__main").text()
|
||||
manga.description = mediaNameLanguage + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + altName + document.select(".media-description__text").text()
|
||||
return manga
|
||||
}
|
||||
|
@ -850,6 +850,7 @@ class LibHentai : ConfigurableSource, HttpSource() {
|
|||
}
|
||||
|
||||
private var server: String? = preferences.getString(SERVER_PREF, null)
|
||||
private var isEng: String? = preferences.getString(LANGUAGE_PREF, "eng")
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
val serverPref = ListPreference(screen.context).apply {
|
||||
key = SERVER_PREF
|
||||
|
|
|
@ -6,7 +6,7 @@ ext {
|
|||
extName = 'MangaLib'
|
||||
pkgNameSuffix = 'ru.libmanga'
|
||||
extClass = '.LibManga'
|
||||
extVersionCode = 60
|
||||
extVersionCode = 61
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -93,7 +93,7 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
|
||||
element.select("a").first().let { link ->
|
||||
manga.setUrlWithoutDomain(link.attr("href"))
|
||||
manga.title = if (preferences.getString(LANGUAGE_PREF, "rus").equals("rus") || element.select(".updates__name_rus").isNullOrEmpty()) { element.select("h4").first().text() } else element.select(".updates__name_rus").first().text()
|
||||
manga.title = if (isEng.equals("rus") || element.select(".updates__name_rus").isNullOrEmpty()) { element.select("h4").first().text() } else element.select(".updates__name_rus").first().text()
|
||||
}
|
||||
return manga
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
private fun popularMangaFromElement(el: JsonElement) = SManga.create().apply {
|
||||
val slug = el.jsonObject["slug"]!!.jsonPrimitive.content
|
||||
val cover = el.jsonObject["cover"]!!.jsonPrimitive.content
|
||||
title = if (preferences.getString(LANGUAGE_PREF, "rus").equals("rus")) el.jsonObject["rus_name"]!!.jsonPrimitive.content else el.jsonObject["name"]!!.jsonPrimitive.content
|
||||
title = if (isEng.equals("rus")) el.jsonObject["rus_name"]!!.jsonPrimitive.content else el.jsonObject["name"]!!.jsonPrimitive.content
|
||||
thumbnail_url = "$COVER_URL/uploads/cover/$slug/cover/${cover}_250x350.jpg"
|
||||
url = "/$slug"
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
else -> "☆☆☆☆☆"
|
||||
}
|
||||
val genres = document.select(".media-tags > a").map { it.text().capitalize() }
|
||||
manga.title = if (preferences.getString(LANGUAGE_PREF, "rus").equals("rus")) document.select(".media-name__main").text() else document.select(".media-name__alt").text()
|
||||
manga.title = if (isEng.equals("rus")) document.select(".media-name__main").text() else document.select(".media-name__alt").text()
|
||||
manga.thumbnail_url = document.select(".media-sidebar__cover > img").attr("src")
|
||||
manga.author = body.select("div.media-info-list__title:contains(Автор) + div").text()
|
||||
manga.artist = body.select("div.media-info-list__title:contains(Художник) + div").text()
|
||||
|
@ -207,13 +207,13 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
"завершен" -> SManga.COMPLETED
|
||||
else -> SManga.UNKNOWN
|
||||
}
|
||||
manga.genre = genres.plusElement(category).plusElement(rawAgeStop).joinToString { it.trim() }
|
||||
manga.genre = category + ", " + rawAgeStop + ", " + genres.joinToString { it.trim() }
|
||||
val altSelector = document.select(".media-info-list__item_alt-names .media-info-list__value div")
|
||||
var altName = ""
|
||||
if (altSelector.isNotEmpty()) {
|
||||
altName = "Альтернативные названия:\n" + altSelector.map { it.text() }.joinToString(" / ") + "\n\n"
|
||||
}
|
||||
val mediaNameLanguage = if (preferences.getString(LANGUAGE_PREF, "rus").equals("rus")) document.select(".media-name__alt").text() else document.select(".media-name__main").text()
|
||||
val mediaNameLanguage = if (isEng.equals("rus")) document.select(".media-name__alt").text() else document.select(".media-name__main").text()
|
||||
manga.description = mediaNameLanguage + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")\n" + altName + document.select(".media-description__text").text()
|
||||
return manga
|
||||
}
|
||||
|
@ -801,6 +801,7 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
}
|
||||
|
||||
private var server: String? = preferences.getString(SERVER_PREF, null)
|
||||
private var isEng: String? = preferences.getString(LANGUAGE_PREF, "eng")
|
||||
override fun setupPreferenceScreen(screen: PreferenceScreen) {
|
||||
val serverPref = ListPreference(screen.context).apply {
|
||||
key = SERVER_PREF
|
||||
|
|
Loading…
Reference in New Issue