[RU] MangaClub: Cleaning code and Update Icons (#10572)

* [RU] MangaClub: Fixing errors again

* [RU] MangaClub: Cleaning code

* [RU] MangaClub: Updating Icons
This commit is contained in:
Román 2022-01-28 05:49:44 +00:00 committed by GitHub
parent febdab05c1
commit 20ad3d2670
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 10 additions and 26 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaClub' extName = 'MangaClub'
pkgNameSuffix = 'ru.mangaclub' pkgNameSuffix = 'ru.mangaclub'
extClass = '.Mangaclub' extClass = '.Mangaclub'
extVersionCode = 7 extVersionCode = 8
isNsfw = true isNsfw = true
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -32,7 +32,7 @@ class Mangaclub : ParsedHttpSource() {
override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply { override fun popularMangaFromElement(element: Element): SManga = SManga.create().apply {
thumbnail_url = element.select("div.content-block>.image>picture>img").attr("abs:src") thumbnail_url = element.select("div.content-block>.image>picture>img").attr("abs:src")
element.select("div.content-title>.title>a").apply { element.select("div.content-title>.title>a").apply {
title = this.text().replace("\\'", "'").substringBefore("/").trim() title = this.text().replace("\\'", "'").trim()
setUrlWithoutDomain(this.attr("abs:href")) setUrlWithoutDomain(this.attr("abs:href"))
} }
} }
@ -59,35 +59,21 @@ class Mangaclub : ParsedHttpSource() {
return POST("$url/index.php?do=search", searchHeaders, formBody) return POST("$url/index.php?do=search", searchHeaders, formBody)
} else { } else {
url += "/f" url += "/f"
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> for (filter in if (filters.isEmpty()) getFilterList() else filters) {
when (filter) { when (filter) {
is GenreList -> { is GenreList -> {
val genresIDs = mutableListOf<String>() val genresIDs = mutableListOf<String>()
filter.state.forEach { genre -> filter.state.forEach { genre -> if (genre.state) genresIDs += genre.id }
if (genre.state) { if (genresIDs.isNotEmpty()) url += "/n.l.tags=${genresIDs.joinToString(",")}"
genresIDs += genre.id
}
}
if (genresIDs.isNotEmpty()) {
url += "/n.l.tags=${genresIDs.joinToString(",")}"
}
} }
is CategoryList -> { is CategoryList -> {
val categoriesIDs = mutableListOf<String>() val categoriesIDs = mutableListOf<String>()
filter.state.forEach { category -> filter.state.forEach { category -> if (category.state) categoriesIDs += category.id }
if (category.state) { if (categoriesIDs.isNotEmpty()) url += "/o.cat=${categoriesIDs.joinToString(",")}"
categoriesIDs += category.id
}
}
if (categoriesIDs.isNotEmpty()) {
url += "/o.cat=${categoriesIDs.joinToString(",")}"
}
} }
is Status -> { is Status -> {
val statusID = arrayOf("Не выбрано", "Завершен", "Продолжается", "Заморожено/Заброшено")[filter.state] val statusID = arrayOf("Не выбрано", "Завершен", "Продолжается", "Заморожено/Заброшено")[filter.state]
if (filter.state > 0) { if (filter.state > 0) url += "/status_translation=$statusID"
url += "/status_translation=$statusID"
}
} }
is OrderBy -> { is OrderBy -> {
val orderState = if (filter.state!!.ascending) "asc" else "desc" val orderState = if (filter.state!!.ascending) "asc" else "desc"
@ -100,7 +86,6 @@ class Mangaclub : ParsedHttpSource() {
} }
return GET(url, headers) return GET(url, headers)
} }
override fun searchMangaNextPageSelector(): String = popularMangaNextPageSelector() override fun searchMangaNextPageSelector(): String = popularMangaNextPageSelector()
override fun searchMangaSelector(): String = popularMangaSelector() override fun searchMangaSelector(): String = popularMangaSelector()
override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element)
@ -109,7 +94,7 @@ class Mangaclub : ParsedHttpSource() {
override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply { override fun mangaDetailsParse(document: Document): SManga = SManga.create().apply {
val licensedStatus = document.select("div.fullstory").text().contains("Данное произведение лицензировано на территории РФ. Главы удалены.") val licensedStatus = document.select("div.fullstory").text().contains("Данное произведение лицензировано на территории РФ. Главы удалены.")
thumbnail_url = document.select("div.content-block>.image>picture>img").attr("abs:src") thumbnail_url = document.select("div.content-block>.image>picture>img").attr("abs:src")
title = document.select("div.info>div>strong").text().replace("\\'", "'").substringBefore("/").trim() title = document.select("div.info>div>strong").text().replace("\\'", "'").trim()
author = document.select("div.info>div>a[href*=author]").text().trim() author = document.select("div.info>div>a[href*=author]").text().trim()
artist = author artist = author
status = when (document.select("div.info>div>a[href*=status_translation]").text().trim()) { status = when (document.select("div.info>div>a[href*=status_translation]").text().trim()) {
@ -139,7 +124,6 @@ class Mangaclub : ParsedHttpSource() {
add(Page(it.attr("data-p").toInt(), "", "${baseUrl.replace("//", "//img.")}/${it.attr("data-i")}")) add(Page(it.attr("data-p").toInt(), "", "${baseUrl.replace("//", "//img.")}/${it.attr("data-i")}"))
} }
} }
override fun imageUrlParse(document: Document): String = "" override fun imageUrlParse(document: Document): String = ""
// Filters // Filters
@ -155,7 +139,7 @@ class Mangaclub : ParsedHttpSource() {
private class OrderBy : Filter.Sort( private class OrderBy : Filter.Sort(
"Сортировка", "Сортировка",
arrayOf("По дате добавления", "По дате обновления", "В алфавитном порядке", "По количеству комментариев", "По количеству просмотров", "По рейтингу"), arrayOf("По дате добавления", "По дате обновления", "В алфавитном порядке", "По количеству комментариев", "По количеству просмотров", "По рейтингу"),
Selection(0, false) Selection(5, false)
) )
override fun getFilterList() = FilterList( override fun getFilterList() = FilterList(