From 6f3ea81db18042d7040763cdf2ef637a5227f24b Mon Sep 17 00:00:00 2001 From: Eugene <35057681+e-shl@users.noreply.github.com> Date: Sat, 22 May 2021 09:20:27 +0500 Subject: [PATCH] [RU] Readmanga & Mintmanga add rate/score and fixes (#7158) * Readmanga & Mintmanga add rate * Fix/simplification code * add sort year * delete sort name(alphabet) * edit the sensitivity of stars * micro-sensitivity underestimation --- src/ru/allhentai/build.gradle | 2 +- .../extension/ru/allhentai/AllHentai.kt | 12 +++---- src/ru/libmanga/build.gradle | 2 +- .../extension/ru/libmanga/LibManga.kt | 10 +++--- src/ru/mintmanga/build.gradle | 2 +- .../extension/ru/mintmanga/Mintmanga.kt | 35 +++++++++++++------ src/ru/readmanga/build.gradle | 2 +- .../extension/ru/readmanga/Readmanga.kt | 35 +++++++++++++------ src/ru/remanga/build.gradle | 2 +- .../tachiyomi/extension/ru/remanga/Remanga.kt | 10 +++--- 10 files changed, 70 insertions(+), 42 deletions(-) diff --git a/src/ru/allhentai/build.gradle b/src/ru/allhentai/build.gradle index 38d807072..14d004922 100644 --- a/src/ru/allhentai/build.gradle +++ b/src/ru/allhentai/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'AllHentai' pkgNameSuffix = 'ru.allhentai' extClass = '.AllHentai' - extVersionCode = 5 + extVersionCode = 6 libVersion = '1.2' containsNsfw = true } diff --git a/src/ru/allhentai/src/eu/kanade/tachiyomi/extension/ru/allhentai/AllHentai.kt b/src/ru/allhentai/src/eu/kanade/tachiyomi/extension/ru/allhentai/AllHentai.kt index 837bb6072..36588e1f6 100644 --- a/src/ru/allhentai/src/eu/kanade/tachiyomi/extension/ru/allhentai/AllHentai.kt +++ b/src/ru/allhentai/src/eu/kanade/tachiyomi/extension/ru/allhentai/AllHentai.kt @@ -88,7 +88,7 @@ class AllHentai : ParsedHttpSource() { } is OrderBy -> { if (filter.state > 0) { - val ord = arrayOf("not", "year", "name", "rate", "popularity", "votes", "created", "updated")[filter.state] + val ord = arrayOf("not", "year", "rate", "popularity", "votes", "created", "updated")[filter.state] val ordUrl = "$baseUrl/list?sortType=$ord".toHttpUrlOrNull()!!.newBuilder() return GET(ordUrl.toString(), headers) } @@ -277,8 +277,8 @@ class AllHentai : ParsedHttpSource() { } private class OrderBy : Filter.Select( - "Сортировка (only)", - arrayOf("Без сортировки", "По году", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления") + "Сортировка (только)", + arrayOf("Без сортировки", "По году", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления") ) private class Genre(name: String, val id: String) : Filter.TriState(name) @@ -286,16 +286,16 @@ class AllHentai : ParsedHttpSource() { private class GenreList(genres: List) : Filter.Group("Жанры", genres) private class Category(categories: List) : Filter.Group("Категории", categories) private class FilList(fils: List) : Filter.Group("Фильтры", fils) - private class Tags(tags: Array) : Filter.Select("Тэг (only)", tags) + private class Tags(tags: Array) : Filter.Select("Тэг (только)", tags) private data class Tag(val name: String, val url: String) override fun getFilterList() = FilterList( OrderBy(), + Tags(tagsName), GenreList(getGenreList()), Category(getCategoryList()), - FilList(getFilList()), - Tags(tagsName) + FilList(getFilList()) ) /* diff --git a/src/ru/libmanga/build.gradle b/src/ru/libmanga/build.gradle index 4a6d4eb68..d553effee 100644 --- a/src/ru/libmanga/build.gradle +++ b/src/ru/libmanga/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'MangaLib' pkgNameSuffix = 'ru.libmanga' extClass = '.LibManga' - extVersionCode = 48 + extVersionCode = 49 libVersion = '1.2' } diff --git a/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt b/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt index 995370755..f2e5ab899 100644 --- a/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt +++ b/src/ru/libmanga/src/eu/kanade/tachiyomi/extension/ru/libmanga/LibManga.kt @@ -181,15 +181,15 @@ class LibManga : ConfigurableSource, HttpSource() { val ratingVotes = document.select(".media-rating.media-rating_lg div.media-rating__votes").text() val ratingStar = when { ratingValue > 9.5 -> "★★★★★" - ratingValue > 9.0 -> "★★★★✬" + ratingValue > 8.5 -> "★★★★✬" ratingValue > 7.5 -> "★★★★☆" - ratingValue > 7.0 -> "★★★✬☆" + ratingValue > 6.5 -> "★★★✬☆" ratingValue > 5.5 -> "★★★☆☆" - ratingValue > 5.0 -> "★★✬☆☆" + ratingValue > 4.5 -> "★★✬☆☆" ratingValue > 3.5 -> "★★☆☆☆" - ratingValue > 3.0 -> "★✬☆☆☆" + ratingValue > 2.5 -> "★✬☆☆☆" ratingValue > 1.5 -> "★☆☆☆☆" - ratingValue > 1.0 -> "✬☆☆☆☆" + ratingValue > 0.5 -> "✬☆☆☆☆" else -> "☆☆☆☆☆" } val genres = document.select(".media-tags > a").map { it.text() } diff --git a/src/ru/mintmanga/build.gradle b/src/ru/mintmanga/build.gradle index c3c4c9ae9..57d7e8ef5 100644 --- a/src/ru/mintmanga/build.gradle +++ b/src/ru/mintmanga/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Mintmanga' pkgNameSuffix = 'ru.mintmanga' extClass = '.Mintmanga' - extVersionCode = 28 + extVersionCode = 29 libVersion = '1.2' } diff --git a/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt b/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt index de8692efd..7891fd1d7 100644 --- a/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt +++ b/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt @@ -69,7 +69,7 @@ class Mintmanga : ParsedHttpSource() { override fun latestUpdatesNextPageSelector() = "a.nextLink" override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - var url = "$baseUrl/search/advanced".toHttpUrlOrNull()!!.newBuilder() + val url = "$baseUrl/search/advanced".toHttpUrlOrNull()!!.newBuilder() (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> when (filter) { is GenreList -> filter.state.forEach { genre -> @@ -98,12 +98,10 @@ class Mintmanga : ParsedHttpSource() { } } is OrderBy -> { - if (filter.state == 0) { - url = "$baseUrl/search/advanced".toHttpUrlOrNull()!!.newBuilder() - } else { - val ord = arrayOf("not", "year", "name", "rate", "popularity", "votes", "created", "updated")[filter.state] - url = "$baseUrl/list?sortType=$ord".toHttpUrlOrNull()!!.newBuilder() - return GET(url.toString(), headers) + if (filter.state > 0) { + val ord = arrayOf("not", "year", "rate", "popularity", "votes", "created", "updated")[filter.state] + val ordUrl = "$baseUrl/list?sortType=$ord".toHttpUrlOrNull()!!.newBuilder() + return GET(ordUrl.toString(), headers) } } } @@ -129,7 +127,22 @@ class Mintmanga : ParsedHttpSource() { } else { "манга" } - + val ratingValue = infoElement.select(".col-sm-7 .rating-block").attr("data-score").toFloat() * 2 + val ratingValueOver = infoElement.select(".info-icon").attr("data-content").substringAfter("Относительно остальных произведений: ").substringBefore("/5").replace(",", ".").toFloat() * 2 + val ratingVotes = infoElement.select(".col-sm-7 .user-rating meta[itemprop=\"ratingCount\"]").attr("content") + val ratingStar = when { + ratingValue > 9.5 -> "★★★★★" + ratingValue > 8.5 -> "★★★★✬" + ratingValue > 7.5 -> "★★★★☆" + ratingValue > 6.5 -> "★★★✬☆" + ratingValue > 5.5 -> "★★★☆☆" + ratingValue > 4.5 -> "★★✬☆☆" + ratingValue > 3.5 -> "★★☆☆☆" + ratingValue > 2.5 -> "★✬☆☆☆" + ratingValue > 1.5 -> "★☆☆☆☆" + ratingValue > 0.5 -> "✬☆☆☆☆" + else -> "☆☆☆☆☆" + } val manga = SManga.create() var authorElement = infoElement.select("span.elem_author").first()?.text() if (authorElement == null) { @@ -143,7 +156,7 @@ class Mintmanga : ParsedHttpSource() { if (infoElement.select(".another-names").isNotEmpty()) { altName = "Альтернативные названия:\n" + infoElement.select(".another-names").text() + "\n\n" } - manga.description = altName + infoElement.select("div.manga-description").text() + manga.description = ratingStar + " " + ratingValue + "[ⓘ" + ratingValueOver + "]" + " (голосов: " + ratingVotes + ")\n" + altName + infoElement.select("div.manga-description").text() manga.status = parseStatus(infoElement.html()) manga.thumbnail_url = infoElement.select("img").attr("data-full") return manga @@ -305,8 +318,8 @@ class Mintmanga : ParsedHttpSource() { } private class OrderBy : Filter.Select( - "Сортировать", - arrayOf("Без(фильтры)", "По году", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления") + "Сортировка (только)", + arrayOf("Без сортировки", "По году", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления") ) private class Genre(name: String, val id: String) : Filter.TriState(name) diff --git a/src/ru/readmanga/build.gradle b/src/ru/readmanga/build.gradle index f518d51b1..7637b8226 100644 --- a/src/ru/readmanga/build.gradle +++ b/src/ru/readmanga/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Readmanga' pkgNameSuffix = 'ru.readmanga' extClass = '.Readmanga' - extVersionCode = 27 + extVersionCode = 28 libVersion = '1.2' } diff --git a/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt b/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt index cc0e09d74..338ac4960 100644 --- a/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt +++ b/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt @@ -69,7 +69,7 @@ class Readmanga : ParsedHttpSource() { override fun latestUpdatesNextPageSelector() = "a.nextLink" override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - var url = "$baseUrl/search/advanced".toHttpUrlOrNull()!!.newBuilder() + val url = "$baseUrl/search/advanced".toHttpUrlOrNull()!!.newBuilder() (if (filters.isEmpty()) getFilterList() else filters).forEach { filter -> when (filter) { is GenreList -> filter.state.forEach { genre -> @@ -98,12 +98,10 @@ class Readmanga : ParsedHttpSource() { } } is OrderBy -> { - if (filter.state == 0) { - url = "$baseUrl/search/advanced".toHttpUrlOrNull()!!.newBuilder() - } else { - val ord = arrayOf("not", "name", "rate", "popularity", "votes", "created", "updated")[filter.state] - url = "$baseUrl/list?sortType=$ord".toHttpUrlOrNull()!!.newBuilder() - return GET(url.toString(), headers) + if (filter.state > 0) { + val ord = arrayOf("not", "year", "rate", "popularity", "votes", "created", "updated")[filter.state] + val ordUrl = "$baseUrl/list?sortType=$ord".toHttpUrlOrNull()!!.newBuilder() + return GET(ordUrl.toString(), headers) } } } @@ -130,6 +128,23 @@ class Readmanga : ParsedHttpSource() { "манга" } + val ratingValue = infoElement.select(".col-sm-7 .rating-block").attr("data-score").toFloat() * 2 + val ratingValueOver = infoElement.select(".info-icon").attr("data-content").substringAfter("Относительно остальных произведений: ").substringBefore("/5").replace(",", ".").toFloat() * 2 + val ratingVotes = infoElement.select(".col-sm-7 .user-rating meta[itemprop=\"ratingCount\"]").attr("content") + val ratingStar = when { + ratingValue > 9.5 -> "★★★★★" + ratingValue > 8.5 -> "★★★★✬" + ratingValue > 7.5 -> "★★★★☆" + ratingValue > 6.5 -> "★★★✬☆" + ratingValue > 5.5 -> "★★★☆☆" + ratingValue > 4.5 -> "★★✬☆☆" + ratingValue > 3.5 -> "★★☆☆☆" + ratingValue > 2.5 -> "★✬☆☆☆" + ratingValue > 1.5 -> "★☆☆☆☆" + ratingValue > 0.5 -> "✬☆☆☆☆" + else -> "☆☆☆☆☆" + } + val manga = SManga.create() var authorElement = infoElement.select("span.elem_author").first()?.text() if (authorElement == null) { @@ -143,7 +158,7 @@ class Readmanga : ParsedHttpSource() { if (infoElement.select(".another-names").isNotEmpty()) { altName = "Альтернативные названия:\n" + infoElement.select(".another-names").text() + "\n\n" } - manga.description = altName + infoElement.select("div.manga-description").text() + manga.description = ratingStar + " " + ratingValue + "[ⓘ" + ratingValueOver + "]" + " (голосов: " + ratingVotes + ")\n" + altName + infoElement.select("div.manga-description").text() manga.status = parseStatus(infoElement.html()) manga.thumbnail_url = infoElement.select("img").attr("data-full") return manga @@ -306,8 +321,8 @@ class Readmanga : ParsedHttpSource() { } private class OrderBy : Filter.Select( - "Сортировать", - arrayOf("Без(фильтры)", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления") + "Сортировка (только)", + arrayOf("Без сортировки", "По году", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления") ) private class Genre(name: String, val id: String) : Filter.TriState(name) diff --git a/src/ru/remanga/build.gradle b/src/ru/remanga/build.gradle index 0e088c7cb..634e0a040 100644 --- a/src/ru/remanga/build.gradle +++ b/src/ru/remanga/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Remanga' pkgNameSuffix = 'ru.remanga' extClass = '.Remanga' - extVersionCode = 24 + extVersionCode = 25 libVersion = '1.2' } diff --git a/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt b/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt index d4007a8f7..fb82d6701 100644 --- a/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt +++ b/src/ru/remanga/src/eu/kanade/tachiyomi/extension/ru/remanga/Remanga.kt @@ -211,15 +211,15 @@ class Remanga : ConfigurableSource, HttpSource() { val ratingValue = avg_rating.toFloat() val ratingStar = when { ratingValue > 9.5 -> "★★★★★" - ratingValue > 9.0 -> "★★★★✬" + ratingValue > 8.5 -> "★★★★✬" ratingValue > 7.5 -> "★★★★☆" - ratingValue > 7.0 -> "★★★✬☆" + ratingValue > 6.5 -> "★★★✬☆" ratingValue > 5.5 -> "★★★☆☆" - ratingValue > 5.0 -> "★★✬☆☆" + ratingValue > 4.5 -> "★★✬☆☆" ratingValue > 3.5 -> "★★☆☆☆" - ratingValue > 3.0 -> "★✬☆☆☆" + ratingValue > 2.5 -> "★✬☆☆☆" ratingValue > 1.5 -> "★☆☆☆☆" - ratingValue > 1.0 -> "✬☆☆☆☆" + ratingValue > 0.5 -> "✬☆☆☆☆" else -> "☆☆☆☆☆" } val o = this