diff --git a/multisrc/overrides/grouple/mintmanga/src/MintManga.kt b/multisrc/overrides/grouple/mintmanga/src/MintManga.kt index 4862a2674..1c6eff68e 100644 --- a/multisrc/overrides/grouple/mintmanga/src/MintManga.kt +++ b/multisrc/overrides/grouple/mintmanga/src/MintManga.kt @@ -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( - "Сортировка (только)", - arrayOf("Без сортировки", "По году", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления") + "Сортировка", + arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу") ) private class Genre(name: String, val id: String) : Filter.TriState(name) diff --git a/multisrc/overrides/grouple/readmanga/src/ReadManga.kt b/multisrc/overrides/grouple/readmanga/src/ReadManga.kt index db61b1247..c2ca15673 100644 --- a/multisrc/overrides/grouple/readmanga/src/ReadManga.kt +++ b/multisrc/overrides/grouple/readmanga/src/ReadManga.kt @@ -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( - "Сортировка (только)", - arrayOf("Без сортировки", "По году", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления") + "Сортировка", + arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу") ) private class Genre(name: String, val id: String) : Filter.TriState(name) diff --git a/multisrc/overrides/grouple/rumix/src/RuMIX.kt b/multisrc/overrides/grouple/rumix/src/RuMIX.kt index 0224e4616..a5bcac89f 100644 --- a/multisrc/overrides/grouple/rumix/src/RuMIX.kt +++ b/multisrc/overrides/grouple/rumix/src/RuMIX.kt @@ -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( + "Сортировка", + arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу") + ) + + override fun getFilterList() = FilterList( + OrderBy() + ) } diff --git a/multisrc/overrides/grouple/selfmanga/src/SelfManga.kt b/multisrc/overrides/grouple/selfmanga/src/SelfManga.kt index 7cb1d361d..b9978f87a 100644 --- a/multisrc/overrides/grouple/selfmanga/src/SelfManga.kt +++ b/multisrc/overrides/grouple/selfmanga/src/SelfManga.kt @@ -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( + "Сортировка", + arrayOf("По популярности", "Популярно сейчас", "По году", "По имени", "Новинки", "По дате обновления", "По рейтингу") + ) + private class Genre(name: String, val id: String) : Filter.TriState(name) - private class GenreList(genres: List) : Filter.Group("Genres", genres) - private class Category(categories: List) : Filter.Group("Category", categories) + private class GenreList(genres: List) : Filter.Group("Жанры", genres) + private class Category(categories: List) : Filter.Group("Категории", categories) override fun getFilterList() = FilterList( + OrderBy(), Category(getCategoryList()), GenreList(getGenreList()) ) diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt index 46d3f68b6..5ebe74e19 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLe.kt @@ -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" diff --git a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLeGenerator.kt b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLeGenerator.kt index 4aa1f6531..91686bf85 100644 --- a/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLeGenerator.kt +++ b/multisrc/src/main/java/eu/kanade/tachiyomi/multisrc/grouple/GroupLeGenerator.kt @@ -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),