Lewdcheck for SY ([RU]Libmanga & Remanga & Desu) (#7222)
* Lewdcheck for SY ([RU]Libmanga & Remanga) * Lewdcheck for SY and Type for J2K ([RU]Desu)
This commit is contained in:
parent
cf390b8629
commit
620a1ea6f9
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Desu'
|
||||
pkgNameSuffix = 'ru.desu'
|
||||
extClass = '.Desu'
|
||||
extVersionCode = 9
|
||||
extVersionCode = 10
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,22 @@ class Desu : HttpSource() {
|
|||
ratingValue > 0.5 -> "✬☆☆☆☆"
|
||||
else -> "☆☆☆☆☆"
|
||||
}
|
||||
val rawAgeValue = obj.getString("adult")
|
||||
val rawAgeStop = when (rawAgeValue) {
|
||||
"1" -> "18+"
|
||||
else -> "0+"
|
||||
}
|
||||
|
||||
val rawTypeValue = obj.getString("kind")
|
||||
val rawTypeStr = when (rawTypeValue) {
|
||||
"manga" -> "Манга"
|
||||
"manhwa" -> "Манхва"
|
||||
"manhua" -> "Маньхуа"
|
||||
"comics" -> "Комикс"
|
||||
"one_shot" -> "Ваншот"
|
||||
else -> "Манга"
|
||||
}
|
||||
|
||||
var altName = ""
|
||||
if (obj.getString("synonyms").isNotEmpty() && obj.getString("synonyms") != "null") {
|
||||
altName = "Альтернативные названия:\n" + obj.getString("synonyms").replace("|", " / ") + "\n\n"
|
||||
|
@ -75,9 +91,9 @@ class Desu : HttpSource() {
|
|||
for (i in 0 until jsonArray.length()) {
|
||||
genreList.add(jsonArray.getJSONObject(i).getString("russian"))
|
||||
}
|
||||
genreList.joinToString()
|
||||
genreList.plusElement(rawTypeStr).plusElement(rawAgeStop).joinToString()
|
||||
} else {
|
||||
obj.getString("genres")
|
||||
obj.getString("genres") + ", " + rawTypeStr + ", " + rawAgeStop
|
||||
}
|
||||
status = when (obj.getString("status")) {
|
||||
"ongoing" -> SManga.ONGOING
|
||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'MangaLib'
|
||||
pkgNameSuffix = 'ru.libmanga'
|
||||
extClass = '.LibManga'
|
||||
extVersionCode = 49
|
||||
extVersionCode = 50
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -170,12 +170,15 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
|
||||
val body = document.select("div.media-info-list").first()
|
||||
val rawCategory = body.select("div.media-info-list__title:contains(Тип) + div").text()
|
||||
|
||||
val category = when {
|
||||
rawCategory == "Комикс западный" -> "комикс"
|
||||
rawCategory.isNotBlank() -> rawCategory.toLowerCase(Locale.ROOT)
|
||||
else -> "манга"
|
||||
}
|
||||
var rawAgeStop = body.select("div.media-info-list__title:contains(Возрастной рейтинг) + div").text()
|
||||
if (rawAgeStop.isEmpty()) {
|
||||
rawAgeStop = "0+"
|
||||
}
|
||||
|
||||
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()
|
||||
|
@ -206,7 +209,7 @@ class LibManga : ConfigurableSource, HttpSource() {
|
|||
"завершен" -> SManga.COMPLETED
|
||||
else -> SManga.UNKNOWN
|
||||
}
|
||||
manga.genre = genres.plusElement(category).joinToString { it.trim() }
|
||||
manga.genre = genres.plusElement(category).plusElement(rawAgeStop).joinToString { it.trim() }
|
||||
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
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'Remanga'
|
||||
pkgNameSuffix = 'ru.remanga'
|
||||
extClass = '.Remanga'
|
||||
extVersionCode = 26
|
||||
extVersionCode = 27
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -205,9 +205,15 @@ class Remanga : ConfigurableSource, HttpSource() {
|
|||
else -> type
|
||||
}
|
||||
}
|
||||
private fun parseAge(age_limit: Int): String {
|
||||
return when (age_limit) {
|
||||
2 -> "18+"
|
||||
1 -> "16+"
|
||||
else -> "0+"
|
||||
}
|
||||
}
|
||||
|
||||
private fun MangaDetDto.toSManga(): SManga {
|
||||
|
||||
val ratingValue = avg_rating.toFloat()
|
||||
val ratingStar = when {
|
||||
ratingValue > 9.5 -> "★★★★★"
|
||||
|
@ -229,7 +235,7 @@ class Remanga : ConfigurableSource, HttpSource() {
|
|||
url = "/api/titles/$dir/"
|
||||
thumbnail_url = "$baseUrl/${img.high}"
|
||||
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 } + ", " + parseAge(age_limit)
|
||||
status = parseStatus(o.status.id)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,8 @@ data class MangaDetDto(
|
|||
val branches: List<BranchesDto>,
|
||||
val status: StatusDto,
|
||||
val avg_rating: String,
|
||||
val count_rating: Int
|
||||
val count_rating: Int,
|
||||
val age_limit: Int
|
||||
)
|
||||
|
||||
data class PropsDto(
|
||||
|
|
Loading…
Reference in New Issue