[RU]GroupLe tags & filters (#12806)

* [RU]GroupLe tags

* OrderBy with filters

* ru naming

* not empty age
This commit is contained in:
Ejan 2022-08-01 03:00:03 +05:00 committed by GitHub
parent 9884a8a060
commit 658fb865a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 75 additions and 33 deletions

View File

@ -13,7 +13,10 @@ class MintManga : GroupLe("MintManga", "https://mintmanga.live", "ru") {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = "$baseUrl/search/advanced?offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
if (query.isNotEmpty()) {
url.addQueryParameter("q", query)
}
(if (filters.isEmpty()) getFilterList().reversed() else filters.reversed()).forEach { filter ->
when (filter) {
is GenreList -> filter.state.forEach { genre ->
if (genre.state != Filter.TriState.STATE_IGNORE) {
@ -41,8 +44,10 @@ class MintManga : GroupLe("MintManga", "https://mintmanga.live", "ru") {
}
}
is OrderBy -> {
if (filter.state > 0) {
val ord = arrayOf("not", "year", "rate", "popularity", "votes", "created", "updated")[filter.state]
if (url.toString().contains("&") && filter.state < 6) {
url.addQueryParameter("sortType", arrayOf("RATING", "POPULARITY", "YEAR", "NAME", "DATE_CREATE", "DATE_UPDATE")[filter.state])
} else {
val ord = arrayOf("rate", "popularity", "year", "name", "created", "updated", "votes")[filter.state]
val ordUrl = "$baseUrl/list?sortType=$ord&offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
return GET(ordUrl.toString(), headers)
}
@ -50,17 +55,14 @@ class MintManga : GroupLe("MintManga", "https://mintmanga.live", "ru") {
else -> return@forEach
}
}
if (query.isNotEmpty()) {
url.addQueryParameter("q", query)
}
return if (url.toString().contains("&"))
GET(url.toString().replace("=%3D", "="), headers)
else popularMangaRequest(page)
}
private class OrderBy : Filter.Select<String>(
"Сортировка (только)",
arrayOf("Без сортировки", "По году", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")
"Сортировка",
arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу")
)
private class Genre(name: String, val id: String) : Filter.TriState(name)

View File

@ -13,7 +13,10 @@ class ReadManga : GroupLe("ReadManga", "https://readmanga.live", "ru") {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = "$baseUrl/search/advanced?offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
if (query.isNotEmpty()) {
url.addQueryParameter("q", query)
}
(if (filters.isEmpty()) getFilterList().reversed() else filters.reversed()).forEach { filter ->
when (filter) {
is GenreList -> filter.state.forEach { genre ->
if (genre.state != Filter.TriState.STATE_IGNORE) {
@ -41,8 +44,10 @@ class ReadManga : GroupLe("ReadManga", "https://readmanga.live", "ru") {
}
}
is OrderBy -> {
if (filter.state > 0) {
val ord = arrayOf("not", "year", "rate", "popularity", "votes", "created", "updated")[filter.state]
if (url.toString().contains("&") && filter.state < 6) {
url.addQueryParameter("sortType", arrayOf("RATING", "POPULARITY", "YEAR", "NAME", "DATE_CREATE", "DATE_UPDATE")[filter.state])
} else {
val ord = arrayOf("rate", "popularity", "year", "name", "created", "updated", "votes")[filter.state]
val ordUrl = "$baseUrl/list?sortType=$ord&offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
return GET(ordUrl.toString(), headers)
}
@ -50,17 +55,14 @@ class ReadManga : GroupLe("ReadManga", "https://readmanga.live", "ru") {
else -> return@forEach
}
}
if (query.isNotEmpty()) {
url.addQueryParameter("q", query)
}
return if (url.toString().contains("&"))
GET(url.toString().replace("=%3D", "="), headers)
else popularMangaRequest(page)
}
private class OrderBy : Filter.Select<String>(
"Сортировка (только)",
arrayOf("Без сортировки", "По году", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")
"Сортировка",
arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу")
)
private class Genre(name: String, val id: String) : Filter.TriState(name)

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.extension.ru.rumix
import eu.kanade.tachiyomi.multisrc.grouple.GroupLe
import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.source.model.Filter
import eu.kanade.tachiyomi.source.model.FilterList
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
import okhttp3.Request
@ -13,8 +14,30 @@ class RuMIX : GroupLe("RuMIX", "https://rumix.me", "ru") {
if (query.isNotEmpty()) {
url.addQueryParameter("q", query)
}
(if (filters.isEmpty()) getFilterList().reversed() else filters.reversed()).forEach { filter ->
when (filter) {
is OrderBy -> {
if (url.toString().contains("&") && filter.state < 6) {
url.addQueryParameter("sortType", arrayOf("RATING", "POPULARITY", "YEAR", "NAME", "DATE_CREATE", "DATE_UPDATE")[filter.state])
} else {
val ord = arrayOf("rate", "popularity", "year", "name", "created", "updated", "votes")[filter.state]
val ordUrl = "$baseUrl/list?sortType=$ord&offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
return GET(ordUrl.toString(), headers)
}
}
else -> return@forEach
}
}
return if (url.toString().contains("&"))
GET(url.toString().replace("=%3D", "="), headers)
else popularMangaRequest(page)
}
private class OrderBy : Filter.Select<String>(
"Сортировка",
arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу")
)
override fun getFilterList() = FilterList(
OrderBy()
)
}

View File

@ -13,7 +13,10 @@ class SelfManga : GroupLe("SelfManga", "https://selfmanga.live", "ru") {
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
val url = "$baseUrl/search/advanced?offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
(if (filters.isEmpty()) getFilterList() else filters).forEach { filter ->
if (query.isNotEmpty()) {
url.addQueryParameter("q", query)
}
(if (filters.isEmpty()) getFilterList().reversed() else filters.reversed()).forEach { filter ->
when (filter) {
is GenreList -> filter.state.forEach { genre ->
if (genre.state != Filter.TriState.STATE_IGNORE) {
@ -25,22 +28,34 @@ class SelfManga : GroupLe("SelfManga", "https://selfmanga.live", "ru") {
url.addQueryParameter(category.id, arrayOf("=", "=in", "=ex")[category.state])
}
}
is OrderBy -> {
if (url.toString().contains("&") && filter.state < 6) {
url.addQueryParameter("sortType", arrayOf("RATING", "POPULARITY", "YEAR", "NAME", "DATE_CREATE", "DATE_UPDATE")[filter.state])
} else {
val ord = arrayOf("rate", "popularity", "year", "name", "created", "updated", "votes")[filter.state]
val ordUrl = "$baseUrl/list?sortType=$ord&offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
return GET(ordUrl.toString(), headers)
}
}
else -> return@forEach
}
}
if (query.isNotEmpty()) {
url.addQueryParameter("q", query)
}
return if (url.toString().contains("&"))
GET(url.toString().replace("=%3D", "="), headers)
else popularMangaRequest(page)
}
private class OrderBy : Filter.Select<String>(
"Сортировка",
arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу")
)
private class Genre(name: String, val id: String) : Filter.TriState(name)
private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Genres", genres)
private class Category(categories: List<Genre>) : Filter.Group<Genre>("Category", categories)
private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Жанры", genres)
private class Category(categories: List<Genre>) : Filter.Group<Genre>("Категории", categories)
override fun getFilterList() = FilterList(
OrderBy(),
Category(getCategoryList()),
GenreList(getGenreList())
)

View File

@ -96,7 +96,7 @@ abstract class GroupLe(
val infoElement = document.select(".expandable").first()
val rawCategory = infoElement.select("span.elem_category").text()
val category = if (rawCategory.isNotEmpty()) {
rawCategory.lowercase()
rawCategory
} else {
"манга"
}
@ -117,15 +117,15 @@ abstract class GroupLe(
ratingValue > 0.5 -> "✬☆☆☆☆"
else -> "☆☆☆☆☆"
}
val rawAgeValue = infoElement.select(".elem_limitation .element-link").first()?.text()
val rawAgeValue = infoElement.select(".elem_limitation .element-link").first()?.text() ?: ""
val rawAgeStop = when (rawAgeValue) {
"NC-17" -> "18+, "
"R18+" -> "18+, "
"R" -> "16+, "
"G" -> "16+, "
"PG" -> "16+, "
"PG-13" -> "12+, "
else -> ""
"NC-17" -> "18+"
"R18+" -> "18+"
"R" -> "16+"
"G" -> "16+"
"PG" -> "16+"
"PG-13" -> "12+"
else -> rawAgeValue
}
val manga = SManga.create()
var authorElement = infoElement.select("span.elem_author").first()?.text()
@ -135,7 +135,7 @@ abstract class GroupLe(
manga.title = document.select("h1.names .name").text()
manga.author = authorElement
manga.artist = infoElement.select("span.elem_illustrator").first()?.text()
manga.genre = category + ", " + rawAgeStop + infoElement.select("span.elem_genre").text().split(",").joinToString { it.trim() }
manga.genre = (category + ", " + rawAgeStop + ", " + infoElement.select("span.elem_genre").text() + ", " + infoElement.select("span.elem_tag").text()).split(", ").filter { it.isNotEmpty() }.joinToString { it.trim().lowercase() }
var altName = ""
if (infoElement.select(".another-names").isNotEmpty()) {
altName = "Альтернативные названия:\n" + infoElement.select(".another-names").text() + "\n\n"

View File

@ -9,7 +9,7 @@ class GroupLeGenerator : ThemeSourceGenerator {
override val themeClass = "GroupLe"
override val baseVersionCode: Int = 5
override val baseVersionCode: Int = 6
override val sources = listOf(
SingleLang("ReadManga", "https://readmanga.live", "ru", overrideVersionCode = 46),