From 6b1a3a20e53087730fe716b4f8b10c0e7b1638c8 Mon Sep 17 00:00:00 2001 From: Taumer Date: Sun, 29 Oct 2017 17:22:04 +0300 Subject: [PATCH] Fix covers url on Mangachan. (#1045) Fix some warnings. --- .../source/online/russian/Mangachan.kt | 25 +++++++------------ .../source/online/russian/Mintmanga.kt | 14 +++++------ .../source/online/russian/Readmanga.kt | 14 +++++------ 3 files changed, 21 insertions(+), 32 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Mangachan.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Mangachan.kt index a104f1b374..20bf46c00d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Mangachan.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Mangachan.kt @@ -23,9 +23,8 @@ class Mangachan : ParsedHttpSource() { override val supportsLatest = true - override fun popularMangaRequest(page: Int): Request { - return GET("$baseUrl/mostfavorites?offset=${20 * (page - 1)}", headers) - } + override fun popularMangaRequest(page: Int): Request = + GET("$baseUrl/mostfavorites?offset=${20 * (page - 1)}", headers) override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { var pageNum = 1 @@ -48,9 +47,7 @@ class Mangachan : ParsedHttpSource() { return GET(url, headers) } - override fun latestUpdatesRequest(page: Int): Request { - return GET("$baseUrl/newestch?page=$page") - } + override fun latestUpdatesRequest(page: Int): Request = GET("$baseUrl/newestch?page=$page") override fun popularMangaSelector() = "div.content_row" @@ -76,9 +73,7 @@ class Mangachan : ParsedHttpSource() { return manga } - override fun searchMangaFromElement(element: Element): SManga { - return popularMangaFromElement(element) - } + override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) override fun popularMangaNextPageSelector() = "a:contains(Вперед)" @@ -125,16 +120,14 @@ class Mangachan : ParsedHttpSource() { manga.genre = infoElement.select("tr:eq(5) > td:eq(1)").text() manga.status = parseStatus(infoElement.select("tr:eq(4) > td:eq(1)").text()) manga.description = descElement.textNodes().first().text() - manga.thumbnail_url = baseUrl + imgElement.attr("src") + manga.thumbnail_url = imgElement.attr("src") return manga } - private fun parseStatus(element: String): Int { - when { - element.contains("перевод завершен") -> return SManga.COMPLETED - element.contains("перевод продолжается") -> return SManga.ONGOING - else -> return SManga.UNKNOWN - } + private fun parseStatus(element: String): Int = when { + element.contains("перевод завершен") -> SManga.COMPLETED + element.contains("перевод продолжается") -> SManga.ONGOING + else -> SManga.UNKNOWN } override fun chapterListSelector() = "table.table_cha tr:gt(1)" diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Mintmanga.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Mintmanga.kt index 845b796197..dbaa49fd7d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Mintmanga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Mintmanga.kt @@ -50,7 +50,7 @@ class Mintmanga : ParsedHttpSource() { override fun latestUpdatesNextPageSelector() = "a.nextLink" override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - val genres = filters.filterIsInstance().map { it.id + arrayOf("=", "=in", "=ex")[it.state] }.joinToString("&") + val genres = filters.filterIsInstance().joinToString("&") { it.id + arrayOf("=", "=in", "=ex")[it.state] } return GET("$baseUrl/search/advanced?q=$query&$genres", headers) } @@ -73,13 +73,11 @@ class Mintmanga : ParsedHttpSource() { return manga } - private fun parseStatus(element: String): Int { - when { - element.contains("

Запрещена публикация произведения по копирайту

") -> return SManga.LICENSED - element.contains("

Сингл") || element.contains("Перевод: завершен") -> return SManga.COMPLETED - element.contains("Перевод: продолжается") -> return SManga.ONGOING - else -> return SManga.UNKNOWN - } + private fun parseStatus(element: String): Int = when { + element.contains("

Запрещена публикация произведения по копирайту

") -> SManga.LICENSED + element.contains("

Сингл") || element.contains("Перевод: завершен") -> SManga.COMPLETED + element.contains("Перевод: продолжается") -> SManga.ONGOING + else -> SManga.UNKNOWN } override fun chapterListSelector() = "div.chapters-link tbody tr" diff --git a/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Readmanga.kt b/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Readmanga.kt index 41527304ad..4bc3383d68 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Readmanga.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/source/online/russian/Readmanga.kt @@ -50,7 +50,7 @@ class Readmanga : ParsedHttpSource() { override fun latestUpdatesNextPageSelector() = "a.nextLink" override fun searchMangaRequest(page: Int, query: String, filters: FilterList): Request { - val genres = filters.filterIsInstance().map { it.id + arrayOf("=", "=in", "=ex")[it.state] }.joinToString("&") + val genres = filters.filterIsInstance().joinToString("&") { it.id + arrayOf("=", "=in", "=ex")[it.state] } return GET("$baseUrl/search/advanced?q=$query&$genres", headers) } @@ -73,13 +73,11 @@ class Readmanga : ParsedHttpSource() { return manga } - private fun parseStatus(element: String): Int { - when { - element.contains("

Запрещена публикация произведения по копирайту

") -> return SManga.LICENSED - element.contains("

Сингл") || element.contains("Перевод: завершен") -> return SManga.COMPLETED - element.contains("Перевод: продолжается") -> return SManga.ONGOING - else -> return SManga.UNKNOWN - } + private fun parseStatus(element: String): Int = when { + element.contains("

Запрещена публикация произведения по копирайту

") -> SManga.LICENSED + element.contains("

Сингл") || element.contains("Перевод: завершен") -> SManga.COMPLETED + element.contains("Перевод: продолжается") -> SManga.ONGOING + else -> SManga.UNKNOWN } override fun chapterListSelector() = "div.chapters-link tbody tr"