[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
This commit is contained in:
Eugene 2021-05-22 09:20:27 +05:00 committed by GitHub
parent 4251a849bc
commit 6f3ea81db1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 70 additions and 42 deletions

View File

@ -5,7 +5,7 @@ ext {
extName = 'AllHentai'
pkgNameSuffix = 'ru.allhentai'
extClass = '.AllHentai'
extVersionCode = 5
extVersionCode = 6
libVersion = '1.2'
containsNsfw = true
}

View File

@ -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<String>(
"Сортировка (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<Genre>) : Filter.Group<Genre>("Жанры", genres)
private class Category(categories: List<Genre>) : Filter.Group<Genre>("Категории", categories)
private class FilList(fils: List<Genre>) : Filter.Group<Genre>("Фильтры", fils)
private class Tags(tags: Array<String>) : Filter.Select<String>("Тэг (only)", tags)
private class Tags(tags: Array<String>) : Filter.Select<String>("Тэг (только)", 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())
)
/*

View File

@ -5,7 +5,7 @@ ext {
extName = 'MangaLib'
pkgNameSuffix = 'ru.libmanga'
extClass = '.LibManga'
extVersionCode = 48
extVersionCode = 49
libVersion = '1.2'
}

View File

@ -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() }

View File

@ -5,7 +5,7 @@ ext {
extName = 'Mintmanga'
pkgNameSuffix = 'ru.mintmanga'
extClass = '.Mintmanga'
extVersionCode = 28
extVersionCode = 29
libVersion = '1.2'
}

View File

@ -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("Относительно остальных произведений: <b>").substringBefore("/5</b>").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<String>(
"Сортировать",
arrayOf("Без(фильтры)", "По году", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")
"Сортировка (только)",
arrayOf("Без сортировки", "По году", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")
)
private class Genre(name: String, val id: String) : Filter.TriState(name)

View File

@ -5,7 +5,7 @@ ext {
extName = 'Readmanga'
pkgNameSuffix = 'ru.readmanga'
extClass = '.Readmanga'
extVersionCode = 27
extVersionCode = 28
libVersion = '1.2'
}

View File

@ -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("Относительно остальных произведений: <b>").substringBefore("/5</b>").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<String>(
"Сортировать",
arrayOf("Без(фильтры)", "По алфавиту", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")
"Сортировка (только)",
arrayOf("Без сортировки", "По году", "По популярности", "Популярно сейчас", "По рейтингу", "Новинки", "По дате обновления")
)
private class Genre(name: String, val id: String) : Filter.TriState(name)

View File

@ -5,7 +5,7 @@ ext {
extName = 'Remanga'
pkgNameSuffix = 'ru.remanga'
extClass = '.Remanga'
extVersionCode = 24
extVersionCode = 25
libVersion = '1.2'
}

View File

@ -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