[RU]GroupLe tags & filters (#12806)
* [RU]GroupLe tags * OrderBy with filters * ru naming * not empty age
This commit is contained in:
parent
9884a8a060
commit
658fb865a4
|
@ -13,7 +13,10 @@ class MintManga : GroupLe("MintManga", "https://mintmanga.live", "ru") {
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
val url = "$baseUrl/search/advanced?offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
|
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) {
|
when (filter) {
|
||||||
is GenreList -> filter.state.forEach { genre ->
|
is GenreList -> filter.state.forEach { genre ->
|
||||||
if (genre.state != Filter.TriState.STATE_IGNORE) {
|
if (genre.state != Filter.TriState.STATE_IGNORE) {
|
||||||
|
@ -41,8 +44,10 @@ class MintManga : GroupLe("MintManga", "https://mintmanga.live", "ru") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is OrderBy -> {
|
is OrderBy -> {
|
||||||
if (filter.state > 0) {
|
if (url.toString().contains("&") && filter.state < 6) {
|
||||||
val ord = arrayOf("not", "year", "rate", "popularity", "votes", "created", "updated")[filter.state]
|
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()
|
val ordUrl = "$baseUrl/list?sortType=$ord&offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
|
||||||
return GET(ordUrl.toString(), headers)
|
return GET(ordUrl.toString(), headers)
|
||||||
}
|
}
|
||||||
|
@ -50,17 +55,14 @@ class MintManga : GroupLe("MintManga", "https://mintmanga.live", "ru") {
|
||||||
else -> return@forEach
|
else -> return@forEach
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (query.isNotEmpty()) {
|
|
||||||
url.addQueryParameter("q", query)
|
|
||||||
}
|
|
||||||
return if (url.toString().contains("&"))
|
return if (url.toString().contains("&"))
|
||||||
GET(url.toString().replace("=%3D", "="), headers)
|
GET(url.toString().replace("=%3D", "="), headers)
|
||||||
else popularMangaRequest(page)
|
else popularMangaRequest(page)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OrderBy : Filter.Select<String>(
|
private class OrderBy : Filter.Select<String>(
|
||||||
"Сортировка (только)",
|
"Сортировка",
|
||||||
arrayOf("Без сортировки", "По году", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")
|
arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу")
|
||||||
)
|
)
|
||||||
|
|
||||||
private class Genre(name: String, val id: String) : Filter.TriState(name)
|
private class Genre(name: String, val id: String) : Filter.TriState(name)
|
||||||
|
|
|
@ -13,7 +13,10 @@ class ReadManga : GroupLe("ReadManga", "https://readmanga.live", "ru") {
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
val url = "$baseUrl/search/advanced?offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
|
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) {
|
when (filter) {
|
||||||
is GenreList -> filter.state.forEach { genre ->
|
is GenreList -> filter.state.forEach { genre ->
|
||||||
if (genre.state != Filter.TriState.STATE_IGNORE) {
|
if (genre.state != Filter.TriState.STATE_IGNORE) {
|
||||||
|
@ -41,8 +44,10 @@ class ReadManga : GroupLe("ReadManga", "https://readmanga.live", "ru") {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is OrderBy -> {
|
is OrderBy -> {
|
||||||
if (filter.state > 0) {
|
if (url.toString().contains("&") && filter.state < 6) {
|
||||||
val ord = arrayOf("not", "year", "rate", "popularity", "votes", "created", "updated")[filter.state]
|
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()
|
val ordUrl = "$baseUrl/list?sortType=$ord&offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
|
||||||
return GET(ordUrl.toString(), headers)
|
return GET(ordUrl.toString(), headers)
|
||||||
}
|
}
|
||||||
|
@ -50,17 +55,14 @@ class ReadManga : GroupLe("ReadManga", "https://readmanga.live", "ru") {
|
||||||
else -> return@forEach
|
else -> return@forEach
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (query.isNotEmpty()) {
|
|
||||||
url.addQueryParameter("q", query)
|
|
||||||
}
|
|
||||||
return if (url.toString().contains("&"))
|
return if (url.toString().contains("&"))
|
||||||
GET(url.toString().replace("=%3D", "="), headers)
|
GET(url.toString().replace("=%3D", "="), headers)
|
||||||
else popularMangaRequest(page)
|
else popularMangaRequest(page)
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OrderBy : Filter.Select<String>(
|
private class OrderBy : Filter.Select<String>(
|
||||||
"Сортировка (только)",
|
"Сортировка",
|
||||||
arrayOf("Без сортировки", "По году", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")
|
arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу")
|
||||||
)
|
)
|
||||||
|
|
||||||
private class Genre(name: String, val id: String) : Filter.TriState(name)
|
private class Genre(name: String, val id: String) : Filter.TriState(name)
|
||||||
|
|
|
@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.extension.ru.rumix
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.grouple.GroupLe
|
import eu.kanade.tachiyomi.multisrc.grouple.GroupLe
|
||||||
import eu.kanade.tachiyomi.network.GET
|
import eu.kanade.tachiyomi.network.GET
|
||||||
|
import eu.kanade.tachiyomi.source.model.Filter
|
||||||
import eu.kanade.tachiyomi.source.model.FilterList
|
import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
import okhttp3.HttpUrl.Companion.toHttpUrlOrNull
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
|
@ -13,8 +14,30 @@ class RuMIX : GroupLe("RuMIX", "https://rumix.me", "ru") {
|
||||||
if (query.isNotEmpty()) {
|
if (query.isNotEmpty()) {
|
||||||
url.addQueryParameter("q", query)
|
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("&"))
|
return if (url.toString().contains("&"))
|
||||||
GET(url.toString().replace("=%3D", "="), headers)
|
GET(url.toString().replace("=%3D", "="), headers)
|
||||||
else popularMangaRequest(page)
|
else popularMangaRequest(page)
|
||||||
}
|
}
|
||||||
|
private class OrderBy : Filter.Select<String>(
|
||||||
|
"Сортировка",
|
||||||
|
arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу")
|
||||||
|
)
|
||||||
|
|
||||||
|
override fun getFilterList() = FilterList(
|
||||||
|
OrderBy()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,10 @@ class SelfManga : GroupLe("SelfManga", "https://selfmanga.live", "ru") {
|
||||||
|
|
||||||
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request {
|
||||||
val url = "$baseUrl/search/advanced?offset=${70 * (page - 1)}".toHttpUrlOrNull()!!.newBuilder()
|
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) {
|
when (filter) {
|
||||||
is GenreList -> filter.state.forEach { genre ->
|
is GenreList -> filter.state.forEach { genre ->
|
||||||
if (genre.state != Filter.TriState.STATE_IGNORE) {
|
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])
|
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
|
else -> return@forEach
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (query.isNotEmpty()) {
|
|
||||||
url.addQueryParameter("q", query)
|
|
||||||
}
|
|
||||||
return if (url.toString().contains("&"))
|
return if (url.toString().contains("&"))
|
||||||
GET(url.toString().replace("=%3D", "="), headers)
|
GET(url.toString().replace("=%3D", "="), headers)
|
||||||
else popularMangaRequest(page)
|
else popularMangaRequest(page)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class OrderBy : Filter.Select<String>(
|
||||||
|
"Сортировка",
|
||||||
|
arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу")
|
||||||
|
)
|
||||||
|
|
||||||
private class Genre(name: String, val id: String) : Filter.TriState(name)
|
private class Genre(name: String, val id: String) : Filter.TriState(name)
|
||||||
private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Genres", genres)
|
private class GenreList(genres: List<Genre>) : Filter.Group<Genre>("Жанры", genres)
|
||||||
private class Category(categories: List<Genre>) : Filter.Group<Genre>("Category", categories)
|
private class Category(categories: List<Genre>) : Filter.Group<Genre>("Категории", categories)
|
||||||
|
|
||||||
override fun getFilterList() = FilterList(
|
override fun getFilterList() = FilterList(
|
||||||
|
OrderBy(),
|
||||||
Category(getCategoryList()),
|
Category(getCategoryList()),
|
||||||
GenreList(getGenreList())
|
GenreList(getGenreList())
|
||||||
)
|
)
|
||||||
|
|
|
@ -96,7 +96,7 @@ abstract class GroupLe(
|
||||||
val infoElement = document.select(".expandable").first()
|
val infoElement = document.select(".expandable").first()
|
||||||
val rawCategory = infoElement.select("span.elem_category").text()
|
val rawCategory = infoElement.select("span.elem_category").text()
|
||||||
val category = if (rawCategory.isNotEmpty()) {
|
val category = if (rawCategory.isNotEmpty()) {
|
||||||
rawCategory.lowercase()
|
rawCategory
|
||||||
} else {
|
} else {
|
||||||
"манга"
|
"манга"
|
||||||
}
|
}
|
||||||
|
@ -117,15 +117,15 @@ abstract class GroupLe(
|
||||||
ratingValue > 0.5 -> "✬☆☆☆☆"
|
ratingValue > 0.5 -> "✬☆☆☆☆"
|
||||||
else -> "☆☆☆☆☆"
|
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) {
|
val rawAgeStop = when (rawAgeValue) {
|
||||||
"NC-17" -> "18+, "
|
"NC-17" -> "18+"
|
||||||
"R18+" -> "18+, "
|
"R18+" -> "18+"
|
||||||
"R" -> "16+, "
|
"R" -> "16+"
|
||||||
"G" -> "16+, "
|
"G" -> "16+"
|
||||||
"PG" -> "16+, "
|
"PG" -> "16+"
|
||||||
"PG-13" -> "12+, "
|
"PG-13" -> "12+"
|
||||||
else -> ""
|
else -> rawAgeValue
|
||||||
}
|
}
|
||||||
val manga = SManga.create()
|
val manga = SManga.create()
|
||||||
var authorElement = infoElement.select("span.elem_author").first()?.text()
|
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.title = document.select("h1.names .name").text()
|
||||||
manga.author = authorElement
|
manga.author = authorElement
|
||||||
manga.artist = infoElement.select("span.elem_illustrator").first()?.text()
|
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 = ""
|
var altName = ""
|
||||||
if (infoElement.select(".another-names").isNotEmpty()) {
|
if (infoElement.select(".another-names").isNotEmpty()) {
|
||||||
altName = "Альтернативные названия:\n" + infoElement.select(".another-names").text() + "\n\n"
|
altName = "Альтернативные названия:\n" + infoElement.select(".another-names").text() + "\n\n"
|
||||||
|
|
|
@ -9,7 +9,7 @@ class GroupLeGenerator : ThemeSourceGenerator {
|
||||||
|
|
||||||
override val themeClass = "GroupLe"
|
override val themeClass = "GroupLe"
|
||||||
|
|
||||||
override val baseVersionCode: Int = 5
|
override val baseVersionCode: Int = 6
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
SingleLang("ReadManga", "https://readmanga.live", "ru", overrideVersionCode = 46),
|
SingleLang("ReadManga", "https://readmanga.live", "ru", overrideVersionCode = 46),
|
||||||
|
|
Loading…
Reference in New Issue