From f3df3a472291ac3ed0839361954023cb0742a465 Mon Sep 17 00:00:00 2001 From: Mike <51273546+SnakeDoc83@users.noreply.github.com> Date: Mon, 9 Sep 2019 08:04:33 -0400 Subject: [PATCH] ReadMangaToday update (#1486) ReadMangaToday update --- src/en/readmangatoday/build.gradle | 2 +- .../en/readmangatoday/Readmangatoday.kt | 34 +++++++++++-------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/en/readmangatoday/build.gradle b/src/en/readmangatoday/build.gradle index 4a8ed3de5..8e21b99b3 100644 --- a/src/en/readmangatoday/build.gradle +++ b/src/en/readmangatoday/build.gradle @@ -5,7 +5,7 @@ ext { appName = 'Tachiyomi: ReadMangaToday' pkgNameSuffix = 'en.readmangatoday' extClass = '.Readmangatoday' - extVersionCode = 6 + extVersionCode = 7 libVersion = '1.2' } diff --git a/src/en/readmangatoday/src/eu/kanade/tachiyomi/extension/en/readmangatoday/Readmangatoday.kt b/src/en/readmangatoday/src/eu/kanade/tachiyomi/extension/en/readmangatoday/Readmangatoday.kt index 52456a60a..982a46f4a 100644 --- a/src/en/readmangatoday/src/eu/kanade/tachiyomi/extension/en/readmangatoday/Readmangatoday.kt +++ b/src/en/readmangatoday/src/eu/kanade/tachiyomi/extension/en/readmangatoday/Readmangatoday.kt @@ -51,6 +51,7 @@ class Readmangatoday : ParsedHttpSource() { manga.setUrlWithoutDomain(it.attr("href")) manga.title = it.attr("title") } + manga.thumbnail_url = element.select("img").attr("src") return manga } @@ -105,7 +106,7 @@ class Readmangatoday : ParsedHttpSource() { manga.status = detailElement.select("dl.dl-horizontal > dd:eq(3)").first()?.text().orEmpty().let { parseStatus(it) } manga.thumbnail_url = detailElement.select("img.img-responsive").first()?.attr("src") - var genres = mutableListOf() + val genres = mutableListOf() genreElement?.forEach { genres.add(it.text()) } manga.genre = genres.joinToString(", ") @@ -135,38 +136,43 @@ class Readmangatoday : ParsedHttpSource() { if (dateWords.size == 3) { val timeAgo = Integer.parseInt(dateWords[0]) - val date: Calendar = Calendar.getInstance() + val calendar = Calendar.getInstance() if (dateWords[1].contains("Minute")) { - date.add(Calendar.MINUTE, -timeAgo) + calendar.add(Calendar.MINUTE, -timeAgo) } else if (dateWords[1].contains("Hour")) { - date.add(Calendar.HOUR_OF_DAY, -timeAgo) + calendar.add(Calendar.HOUR_OF_DAY, -timeAgo) } else if (dateWords[1].contains("Day")) { - date.add(Calendar.DAY_OF_YEAR, -timeAgo) + calendar.add(Calendar.DAY_OF_YEAR, -timeAgo) } else if (dateWords[1].contains("Week")) { - date.add(Calendar.WEEK_OF_YEAR, -timeAgo) + calendar.add(Calendar.WEEK_OF_YEAR, -timeAgo) } else if (dateWords[1].contains("Month")) { - date.add(Calendar.MONTH, -timeAgo) + calendar.add(Calendar.MONTH, -timeAgo) } else if (dateWords[1].contains("Year")) { - date.add(Calendar.YEAR, -timeAgo) + calendar.add(Calendar.YEAR, -timeAgo) } - return date.timeInMillis + return calendar.timeInMillis } return 0L } + override fun pageListRequest(chapter: SChapter): Request { + return GET("$baseUrl/${chapter.url}/all-pages", headers) + } + override fun pageListParse(document: Document): List { val pages = mutableListOf() - document.select("ul.list-switcher-2 > li > select.jump-menu").first().getElementsByTag("option").forEach { - pages.add(Page(pages.size, it.attr("value"))) + + document.select("div.content-list img").forEachIndexed{ i, img -> + pages.add(Page(i, "", img.attr("abs:src"))) } - pages.getOrNull(0)?.imageUrl = imageUrlParse(document) + return pages } - override fun imageUrlParse(document: Document) = document.select("#chapter_img").first().attr("src") + override fun imageUrlParse(document: Document): String = throw UnsupportedOperationException("Not used") private class Status : Filter.TriState("Completed") private class Genre(name: String, val id: Int) : Filter.TriState(name) @@ -221,4 +227,4 @@ class Readmangatoday : ParsedHttpSource() { Genre("Yaoi", 36), Genre("Yuri", 37) ) -} \ No newline at end of file +}