Readmanga and Mintmanga: Status fix (#2703)

This commit is contained in:
Kirill 2020-04-19 04:13:20 +05:00 committed by GitHub
parent d4579b7e77
commit 8f5ddea8a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 34 deletions

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Mintmanga' appName = 'Tachiyomi: Mintmanga'
pkgNameSuffix = 'ru.mintmanga' pkgNameSuffix = 'ru.mintmanga'
extClass = '.Mintmanga' extClass = '.Mintmanga'
extVersionCode = 20 extVersionCode = 21
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -96,26 +96,16 @@ class Mintmanga : ParsedHttpSource() {
manga.artist = infoElement.select("span.elem_illustrator").first()?.text() manga.artist = infoElement.select("span.elem_illustrator").first()?.text()
manga.genre = infoElement.select("span.elem_genre").text().replace(" ,", ",") manga.genre = infoElement.select("span.elem_genre").text().replace(" ,", ",")
manga.description = infoElement.select("div.manga-description").text() manga.description = infoElement.select("div.manga-description").text()
manga.status = parseStatus(infoElement) manga.status = parseStatus(infoElement.html())
manga.thumbnail_url = infoElement.select("img").attr("data-full") manga.thumbnail_url = infoElement.select("img").attr("data-full")
return manga return manga
} }
private fun parseStatus(element: Element): Int { private fun parseStatus(element: String): Int = when {
val hiddenWarningMessage = element.select("span.hide > h3").first() element.contains("Запрещена публикация произведения по копирайту") -> SManga.LICENSED
val html = element.html() element.contains("<h1 class=\"names\"> Сингл") || element.contains("<b>Перевод:</b> завершен") -> SManga.COMPLETED
return if (hiddenWarningMessage != null) { element.contains("<b>Перевод:</b> продолжается") -> SManga.ONGOING
when { else -> SManga.UNKNOWN
html.contains("<b>Перевод:</b> продолжается") -> SManga.ONGOING
html.contains("<h1 class=\"names\"> Сингл") || html.contains("<b>Перевод:</b> завершен") -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
} else {
when {
html.contains("<h3>Запрещена публикация произведения по копирайту</h3>") -> SManga.LICENSED
else -> SManga.UNKNOWN
}
}
} }
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> { override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {

View File

@ -5,7 +5,7 @@ ext {
appName = 'Tachiyomi: Readmanga' appName = 'Tachiyomi: Readmanga'
pkgNameSuffix = 'ru.readmanga' pkgNameSuffix = 'ru.readmanga'
extClass = '.Readmanga' extClass = '.Readmanga'
extVersionCode = 17 extVersionCode = 18
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -96,26 +96,16 @@ class Readmanga : ParsedHttpSource() {
manga.artist = infoElement.select("span.elem_illustrator").first()?.text() manga.artist = infoElement.select("span.elem_illustrator").first()?.text()
manga.genre = infoElement.select("span.elem_genre").text().replace(" ,", ",") manga.genre = infoElement.select("span.elem_genre").text().replace(" ,", ",")
manga.description = infoElement.select("div.manga-description").text() manga.description = infoElement.select("div.manga-description").text()
manga.status = parseStatus(infoElement) manga.status = parseStatus(infoElement.html())
manga.thumbnail_url = infoElement.select("img").attr("data-full") manga.thumbnail_url = infoElement.select("img").attr("data-full")
return manga return manga
} }
private fun parseStatus(element: Element): Int { private fun parseStatus(element: String): Int = when {
val hiddenWarningMessage = element.select("span.hide > h3").first() element.contains("Запрещена публикация произведения по копирайту") -> SManga.LICENSED
val html = element.html() element.contains("<h1 class=\"names\"> Сингл") || element.contains("<b>Перевод:</b> завершен") -> SManga.COMPLETED
return if (hiddenWarningMessage != null) { element.contains("<b>Перевод:</b> продолжается") -> SManga.ONGOING
when { else -> SManga.UNKNOWN
html.contains("<b>Перевод:</b> продолжается") -> SManga.ONGOING
html.contains("<h1 class=\"names\"> Сингл") || html.contains("<b>Перевод:</b> завершен") -> SManga.COMPLETED
else -> SManga.UNKNOWN
}
} else {
when {
html.contains("<h3>Запрещена публикация произведения по копирайту</h3>") -> SManga.LICENSED
else -> SManga.UNKNOWN
}
}
} }
override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> { override fun fetchChapterList(manga: SManga): Observable<List<SChapter>> {