From 15f38383b3bab446ceb70864e8caf8ce7ca7118b Mon Sep 17 00:00:00 2001 From: Riztard Lanthorn Date: Fri, 13 Nov 2020 19:10:52 +0700 Subject: [PATCH] ReadM fix manga Status (#4859) manga status not included(recently added) --- src/en/readm/build.gradle | 2 +- .../src/eu/kanade/tachiyomi/extension/en/readm/ReadM.kt | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/en/readm/build.gradle b/src/en/readm/build.gradle index 615a4d2da..be4881500 100644 --- a/src/en/readm/build.gradle +++ b/src/en/readm/build.gradle @@ -5,7 +5,7 @@ ext { extName = 'ReadM' pkgNameSuffix = 'en.readm' extClass = '.ReadM' - extVersionCode = 3 + extVersionCode = 4 libVersion = '1.2' } diff --git a/src/en/readm/src/eu/kanade/tachiyomi/extension/en/readm/ReadM.kt b/src/en/readm/src/eu/kanade/tachiyomi/extension/en/readm/ReadM.kt index f799545ed..7669a2aae 100644 --- a/src/en/readm/src/eu/kanade/tachiyomi/extension/en/readm/ReadM.kt +++ b/src/en/readm/src/eu/kanade/tachiyomi/extension/en/readm/ReadM.kt @@ -95,6 +95,14 @@ class ReadM : ParsedHttpSource() { artist = document.select("span#last_episode a").text().trim() description = document.select("div.series-summary-wrapper p").text().trim() genre = document.select("div.series-summary-wrapper div.item a").joinToString(", ") { it.text().trim() } + status = parseStatus(document.select("div.series-genres .series-status").firstOrNull()?.ownText()) + } + + protected fun parseStatus(element: String?): Int = when { + element == null -> SManga.UNKNOWN + listOf("ongoing").any { it.contains(element, ignoreCase = true) } -> SManga.ONGOING + listOf("completed").any { it.contains(element, ignoreCase = true) } -> SManga.COMPLETED + else -> SManga.UNKNOWN } // Chapters