Remanga & Libmanga add rate (#7147)
This commit is contained in:
parent
f0caf41d32
commit
f34d344577
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'MangaLib'
|
extName = 'MangaLib'
|
||||||
pkgNameSuffix = 'ru.libmanga'
|
pkgNameSuffix = 'ru.libmanga'
|
||||||
extClass = '.LibManga'
|
extClass = '.LibManga'
|
||||||
extVersionCode = 47
|
extVersionCode = 48
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -177,6 +177,21 @@ class LibManga : ConfigurableSource, HttpSource() {
|
||||||
else -> "манга"
|
else -> "манга"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val ratingValue = document.select(".media-rating.media-rating_lg div.media-rating__value").text().toFloat() * 2
|
||||||
|
val ratingVotes = document.select(".media-rating.media-rating_lg div.media-rating__votes").text()
|
||||||
|
val ratingStar = when {
|
||||||
|
ratingValue > 9.5 -> "★★★★★"
|
||||||
|
ratingValue > 9.0 -> "★★★★✬"
|
||||||
|
ratingValue > 7.5 -> "★★★★☆"
|
||||||
|
ratingValue > 7.0 -> "★★★✬☆"
|
||||||
|
ratingValue > 5.5 -> "★★★☆☆"
|
||||||
|
ratingValue > 5.0 -> "★★✬☆☆"
|
||||||
|
ratingValue > 3.5 -> "★★☆☆☆"
|
||||||
|
ratingValue > 3.0 -> "★✬☆☆☆"
|
||||||
|
ratingValue > 1.5 -> "★☆☆☆☆"
|
||||||
|
ratingValue > 1.0 -> "✬☆☆☆☆"
|
||||||
|
else -> "☆☆☆☆☆"
|
||||||
|
}
|
||||||
val genres = document.select(".media-tags > a").map { it.text() }
|
val genres = document.select(".media-tags > a").map { it.text() }
|
||||||
manga.title = document.select(".media-name__alt").text()
|
manga.title = document.select(".media-name__alt").text()
|
||||||
manga.thumbnail_url = baseUrl + document.select(".media-sidebar__cover > img").attr("src").substringAfter(baseOrig)
|
manga.thumbnail_url = baseUrl + document.select(".media-sidebar__cover > img").attr("src").substringAfter(baseOrig)
|
||||||
|
@ -192,7 +207,7 @@ class LibManga : ConfigurableSource, HttpSource() {
|
||||||
else -> SManga.UNKNOWN
|
else -> SManga.UNKNOWN
|
||||||
}
|
}
|
||||||
manga.genre = genres.plusElement(category).joinToString { it.trim() }
|
manga.genre = genres.plusElement(category).joinToString { it.trim() }
|
||||||
manga.description = document.select(".media-name__main").text() + "\nАльтернативные названия:\n" + document.select(".media-info-list__item_alt-names .media-info-list__value div").map { it.text() }.joinToString(" / ") + "\n\n" + document.select(".media-description__text").text()
|
manga.description = document.select(".media-name__main").text() + "\n" + ratingStar + " " + ratingValue + " (голосов: " + ratingVotes + ")" + "\nАльтернативные названия:\n" + document.select(".media-info-list__item_alt-names .media-info-list__value div").map { it.text() }.joinToString(" / ") + "\n\n" + document.select(".media-description__text").text()
|
||||||
return manga
|
return manga
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Remanga'
|
extName = 'Remanga'
|
||||||
pkgNameSuffix = 'ru.remanga'
|
pkgNameSuffix = 'ru.remanga'
|
||||||
extClass = '.Remanga'
|
extClass = '.Remanga'
|
||||||
extVersionCode = 23
|
extVersionCode = 24
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -207,13 +207,28 @@ class Remanga : ConfigurableSource, HttpSource() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun MangaDetDto.toSManga(): SManga {
|
private fun MangaDetDto.toSManga(): SManga {
|
||||||
|
|
||||||
|
val ratingValue = avg_rating.toFloat()
|
||||||
|
val ratingStar = when {
|
||||||
|
ratingValue > 9.5 -> "★★★★★"
|
||||||
|
ratingValue > 9.0 -> "★★★★✬"
|
||||||
|
ratingValue > 7.5 -> "★★★★☆"
|
||||||
|
ratingValue > 7.0 -> "★★★✬☆"
|
||||||
|
ratingValue > 5.5 -> "★★★☆☆"
|
||||||
|
ratingValue > 5.0 -> "★★✬☆☆"
|
||||||
|
ratingValue > 3.5 -> "★★☆☆☆"
|
||||||
|
ratingValue > 3.0 -> "★✬☆☆☆"
|
||||||
|
ratingValue > 1.5 -> "★☆☆☆☆"
|
||||||
|
ratingValue > 1.0 -> "✬☆☆☆☆"
|
||||||
|
else -> "☆☆☆☆☆"
|
||||||
|
}
|
||||||
val o = this
|
val o = this
|
||||||
return SManga.create().apply {
|
return SManga.create().apply {
|
||||||
// Do not change the title name to ensure work with a multilingual catalog!
|
// Do not change the title name to ensure work with a multilingual catalog!
|
||||||
title = en_name
|
title = en_name
|
||||||
url = "/api/titles/$dir/"
|
url = "/api/titles/$dir/"
|
||||||
thumbnail_url = "$baseUrl/${img.high}"
|
thumbnail_url = "$baseUrl/${img.high}"
|
||||||
this.description = rus_name + "\nАльтернативные названия:\n" + another_name + "\n\n" + Jsoup.parse(o.description).text()
|
this.description = rus_name + "\n" + ratingStar + " " + ratingValue + " (голосов: " + count_rating + ")" + "\nАльтернативные названия:\n" + another_name + "\n\n" + Jsoup.parse(o.description).text()
|
||||||
genre = (genres + parseType(type)).joinToString { it.name }
|
genre = (genres + parseType(type)).joinToString { it.name }
|
||||||
status = parseStatus(o.status.id)
|
status = parseStatus(o.status.id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,9 @@ data class MangaDetDto(
|
||||||
val type: GenresDto,
|
val type: GenresDto,
|
||||||
val genres: List<GenresDto>,
|
val genres: List<GenresDto>,
|
||||||
val branches: List<BranchesDto>,
|
val branches: List<BranchesDto>,
|
||||||
val status: StatusDto
|
val status: StatusDto,
|
||||||
|
val avg_rating: String,
|
||||||
|
val count_rating: Int
|
||||||
)
|
)
|
||||||
|
|
||||||
data class PropsDto(
|
data class PropsDto(
|
||||||
|
|
Loading…
Reference in New Issue