From 72a6ca9712be01478fe02b70933e4a9396903b3f Mon Sep 17 00:00:00 2001 From: Carlos Date: Sat, 9 Dec 2017 10:09:20 -0500 Subject: [PATCH] update mint/readmanga (#137) * update mint/read manga to external source to match most up to date of internal tachiyomi app * fixed incorrect package * updated version code * reverted extVersionSuffix * updated to latest LibVersion updated extVersion * fixed suffix since doesn't need to increment since lib did. --- src/ru/mintmanga/build.gradle | 6 +-- .../extension/ru/mintmanga/Mintmanga.kt | 40 ++++++++----------- src/ru/readmanga/build.gradle | 6 +-- .../extension/ru/readmanga/Readmanga.kt | 39 ++++++++---------- 4 files changed, 39 insertions(+), 52 deletions(-) diff --git a/src/ru/mintmanga/build.gradle b/src/ru/mintmanga/build.gradle index b5400e655..576a40ef9 100644 --- a/src/ru/mintmanga/build.gradle +++ b/src/ru/mintmanga/build.gradle @@ -5,9 +5,9 @@ ext { appName = 'Tachiyomi: Mintmanga' pkgNameSuffix = "ru.mintmanga" extClass = '.Mintmanga' - extVersionCode = 2 - extVersionSuffix = 2 - libVersion = '1.0' + extVersionCode = 3 + extVersionSuffix = 0 + libVersion = '1.2' } apply from: "$rootDir/common.gradle" diff --git a/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt b/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt index 2ad105c97..b5146b96a 100644 --- a/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt +++ b/src/ru/mintmanga/src/eu/kanade/tachiyomi/extension/ru/mintmanga/Mintmanga.kt @@ -23,13 +23,11 @@ class Mintmanga : ParsedHttpSource() { override val supportsLatest = true - override fun popularMangaRequest(page: Int): Request { - return GET("$baseUrl/list?sortType=rate&offset=${70 * (page - 1)}&max=70", headers) - } + override fun popularMangaRequest(page: Int): Request = + GET("$baseUrl/list?sortType=rate&offset=${70 * (page - 1)}&max=70", headers) - override fun latestUpdatesRequest(page: Int): Request { - return GET("$baseUrl/list?sortType=updated&offset=${70 * (page - 1)}&max=70", headers) - } + override fun latestUpdatesRequest(page: Int): Request = + GET("$baseUrl/list?sortType=updated&offset=${70 * (page - 1)}&max=70", headers) override fun popularMangaSelector() = "div.desc" @@ -44,24 +42,21 @@ class Mintmanga : ParsedHttpSource() { return manga } - override fun latestUpdatesFromElement(element: Element): SManga { - return popularMangaFromElement(element) - } + override fun latestUpdatesFromElement(element: Element): SManga = + popularMangaFromElement(element) override fun popularMangaNextPageSelector() = "a.nextLink" 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("&") - return GET("$baseUrl/search?q=$query&$genres", headers) + val genres = filters.filterIsInstance().joinToString("&") { it.id + arrayOf("=", "=in", "=ex")[it.state] } + return GET("$baseUrl/search/advanced?q=$query&$genres", headers) } override fun searchMangaSelector() = popularMangaSelector() - override fun searchMangaFromElement(element: Element): SManga { - return popularMangaFromElement(element) - } + override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) // max 200 results override fun searchMangaNextPageSelector() = null @@ -78,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" @@ -125,7 +118,7 @@ class Mintmanga : ParsedHttpSource() { val endIndex = html.indexOf("], 0, false);", beginIndex) val trimmedHtml = html.substring(beginIndex, endIndex) - val p = Pattern.compile("'.+?','.+?',\".+?\"") + val p = Pattern.compile("'.*?','.*?',\".*?\"") val m = p.matcher(trimmedHtml) val pages = mutableListOf() @@ -149,7 +142,7 @@ class Mintmanga : ParsedHttpSource() { /* [...document.querySelectorAll("tr.advanced_option:nth-child(1) > td:nth-child(3) span.js-link")].map((el,i) => { * const onClick=el.getAttribute('onclick');const id=onClick.substr(31,onClick.length-33); * return `Genre("${el.textContent.trim()}", "${id}")` }).join(',\n') - * on http://mintmanga.com/search + * on http://mintmanga.com/search/advanced */ override fun getFilterList() = FilterList( Genre("арт", "el_2220"), @@ -171,6 +164,7 @@ class Mintmanga : ParsedHttpSource() { Genre("меха", "el_1318"), Genre("мистика", "el_1324"), Genre("научная фантастика", "el_1325"), + Genre("омегаверс", "el_5676"), Genre("повседневность", "el_1327"), Genre("постапокалиптика", "el_1342"), Genre("приключения", "el_1322"), diff --git a/src/ru/readmanga/build.gradle b/src/ru/readmanga/build.gradle index d45dabfba..1ccec7cc4 100644 --- a/src/ru/readmanga/build.gradle +++ b/src/ru/readmanga/build.gradle @@ -5,9 +5,9 @@ ext { appName = 'Tachiyomi: Readmanga' pkgNameSuffix = "ru.readmanga" extClass = '.Readmanga' - extVersionCode = 2 - extVersionSuffix = 2 - libVersion = '1.0' + extVersionCode = 3 + extVersionSuffix = 0 + libVersion = '1.2' } apply from: "$rootDir/common.gradle" diff --git a/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt b/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt index d8140174f..a1da1ea2d 100644 --- a/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt +++ b/src/ru/readmanga/src/eu/kanade/tachiyomi/extension/ru/readmanga/Readmanga.kt @@ -27,13 +27,11 @@ class Readmanga : ParsedHttpSource() { override fun latestUpdatesSelector() = "div.desc" - override fun popularMangaRequest(page: Int): Request { - return GET("$baseUrl/list?sortType=rate&offset=${70 * (page - 1)}&max=70", headers) - } + override fun popularMangaRequest(page: Int): Request = + GET("$baseUrl/list?sortType=rate&offset=${70 * (page - 1)}&max=70", headers) - override fun latestUpdatesRequest(page: Int): Request { - return GET("$baseUrl/list?sortType=updated&offset=${70 * (page - 1)}&max=70", headers) - } + override fun latestUpdatesRequest(page: Int): Request = + GET("$baseUrl/list?sortType=updated&offset=${70 * (page - 1)}&max=70", headers) override fun popularMangaFromElement(element: Element): SManga { val manga = SManga.create() @@ -44,24 +42,21 @@ class Readmanga : ParsedHttpSource() { return manga } - override fun latestUpdatesFromElement(element: Element): SManga { - return popularMangaFromElement(element) - } + override fun latestUpdatesFromElement(element: Element): SManga = + popularMangaFromElement(element) override fun popularMangaNextPageSelector() = "a.nextLink" 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("&") - return GET("$baseUrl/search?q=$query&$genres", headers) + val genres = filters.filterIsInstance().joinToString("&") { it.id + arrayOf("=", "=in", "=ex")[it.state] } + return GET("$baseUrl/search/advanced?q=$query&$genres", headers) } override fun searchMangaSelector() = popularMangaSelector() - override fun searchMangaFromElement(element: Element): SManga { - return popularMangaFromElement(element) - } + override fun searchMangaFromElement(element: Element): SManga = popularMangaFromElement(element) // max 200 results override fun searchMangaNextPageSelector() = null @@ -78,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" @@ -125,7 +118,7 @@ class Readmanga : ParsedHttpSource() { val endIndex = html.indexOf("], 0, false);", beginIndex) val trimmedHtml = html.substring(beginIndex, endIndex) - val p = Pattern.compile("'.+?','.+?',\".+?\"") + val p = Pattern.compile("'.*?','.*?',\".*?\"") val m = p.matcher(trimmedHtml) val pages = mutableListOf() @@ -149,7 +142,7 @@ class Readmanga : ParsedHttpSource() { /* [...document.querySelectorAll("tr.advanced_option:nth-child(1) > td:nth-child(3) span.js-link")].map((el,i) => { * const onClick=el.getAttribute('onclick');const id=onClick.substr(31,onClick.length-33); * return `Genre("${el.textContent.trim()}", "${id}")` }).join(',\n') - * on http://readmanga.me/search + * on http://readmanga.me/search/advanced */ override fun getFilterList() = FilterList( Genre("арт", "el_5685"),