From 20d4513149bba391eaae7ef9b41d944658bd343a Mon Sep 17 00:00:00 2001 From: Eugene <35057681+e-shl@users.noreply.github.com> Date: Sat, 22 May 2021 16:33:37 +0500 Subject: [PATCH] [RU]Desu Rus+Alttitle Rate (#7167) --- src/ru/desu/build.gradle | 2 +- .../tachiyomi/extension/ru/desu/Desu.kt | 20 ++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/ru/desu/build.gradle b/src/ru/desu/build.gradle index acb74351f..4d78fd482 100644 --- a/src/ru/desu/build.gradle +++ b/src/ru/desu/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'Desu' pkgNameSuffix = 'ru.desu' extClass = '.Desu' - extVersionCode = 8 + extVersionCode = 9 libVersion = '1.2' } diff --git a/src/ru/desu/src/eu/kanade/tachiyomi/extension/ru/desu/Desu.kt b/src/ru/desu/src/eu/kanade/tachiyomi/extension/ru/desu/Desu.kt index c8d61c178..408726fac 100644 --- a/src/ru/desu/src/eu/kanade/tachiyomi/extension/ru/desu/Desu.kt +++ b/src/ru/desu/src/eu/kanade/tachiyomi/extension/ru/desu/Desu.kt @@ -50,7 +50,25 @@ class Desu : HttpSource() { url = "/$id" title = obj.getString("name") thumbnail_url = obj.getJSONObject("image").getString("original") - description = obj.getString("description") + val ratingValue = obj.getString("score").toFloat() + 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 -> "☆☆☆☆☆" + } + var altName = "" + if (obj.getString("synonyms").isNotEmpty() && obj.getString("synonyms") != "null") { + altName = "Альтернативные названия:\n" + obj.getString("synonyms").replace("|", " / ") + "\n\n" + } + description = obj.getString("russian") + "\n" + ratingStar + " " + ratingValue + " (голосов: " + obj.getString("score_users") + ")\n" + altName + obj.getString("description") genre = if (chapter) { val jsonArray = obj.getJSONArray("genres") val genreList = mutableListOf()