From 923490d0ad7822c0f4a9112d9ad6b381462743e9 Mon Sep 17 00:00:00 2001 From: pavka Date: Thu, 19 Apr 2018 19:37:55 +0300 Subject: [PATCH 1/3] Fix time for Rawlh source --- .../tachiyomi/extension/ja/rawlh/Rawlh.kt | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/src/ja/rawlh/src/eu/kanade/tachiyomi/extension/ja/rawlh/Rawlh.kt b/src/ja/rawlh/src/eu/kanade/tachiyomi/extension/ja/rawlh/Rawlh.kt index 348b7ff9c..ac79d5fe1 100644 --- a/src/ja/rawlh/src/eu/kanade/tachiyomi/extension/ja/rawlh/Rawlh.kt +++ b/src/ja/rawlh/src/eu/kanade/tachiyomi/extension/ja/rawlh/Rawlh.kt @@ -7,6 +7,7 @@ import okhttp3.HttpUrl import okhttp3.Request import org.jsoup.nodes.Document import org.jsoup.nodes.Element +import java.util.Calendar class Rawlh : ParsedHttpSource() { @@ -106,14 +107,44 @@ class Rawlh : ParsedHttpSource() { override fun chapterFromElement(element: Element): SChapter { val urlElement = element.select("td a").first() + val timeElement = element.select("td time").first() val chapter = SChapter.create() chapter.setUrlWithoutDomain("/" + urlElement.attr("href")) chapter.name = urlElement.text() - chapter.date_upload = 0 + chapter.date_upload = parseChapterDate(timeElement.text()) return chapter } + private fun parseChapterDate(date: String): Long { + val value = date.split(' ')[0].toInt() + return when { + "hour(s) ago" in date -> Calendar.getInstance().apply { + add(Calendar.HOUR_OF_DAY, value * -1) + set(Calendar.SECOND, 0) + set(Calendar.MILLISECOND, 0) + }.timeInMillis + "day(s) ago" in date -> Calendar.getInstance().apply { + add(Calendar.DATE, value * -1) + set(Calendar.SECOND, 0) + set(Calendar.MILLISECOND, 0) + }.timeInMillis + "week(s) ago" in date -> Calendar.getInstance().apply { + add(Calendar.DATE, value * 7 * -1) + set(Calendar.SECOND, 0) + set(Calendar.MILLISECOND, 0) + }.timeInMillis + "month(s) ago" in date -> Calendar.getInstance().apply { + add(Calendar.MONTH, value * -1) + set(Calendar.SECOND, 0) + set(Calendar.MILLISECOND, 0) + }.timeInMillis + else -> { + return 0 + } + } + } + override fun pageListParse(document: Document): List { val pages = mutableListOf() From 7a1bd791cfbb33a3161ba6ba333bd17f18ede0f4 Mon Sep 17 00:00:00 2001 From: Pavka Date: Fri, 20 Apr 2018 11:05:57 +0300 Subject: [PATCH 2/3] Update build.gradle New version --- src/ja/rawlh/build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ja/rawlh/build.gradle b/src/ja/rawlh/build.gradle index b861437f6..15e72a793 100644 --- a/src/ja/rawlh/build.gradle +++ b/src/ja/rawlh/build.gradle @@ -6,8 +6,8 @@ ext { pkgNameSuffix = "ja.rawlh" extClass = '.Rawlh' extVersionCode = 1 - extVersionSuffix = 0 - libVersion = '1.0' + extVersionSuffix = 1 + libVersion = '1.1' } apply from: "$rootDir/common.gradle" From e97f14a085e4e2be87ee3808c911b5df9fc6f5e5 Mon Sep 17 00:00:00 2001 From: Pavka Date: Sun, 22 Apr 2018 23:50:45 +0300 Subject: [PATCH 3/3] Update build.gradle Fix version --- src/ja/rawlh/build.gradle | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ja/rawlh/build.gradle b/src/ja/rawlh/build.gradle index 15e72a793..777d73e60 100644 --- a/src/ja/rawlh/build.gradle +++ b/src/ja/rawlh/build.gradle @@ -5,9 +5,9 @@ ext { appName = 'Tachiyomi: RawLH' pkgNameSuffix = "ja.rawlh" extClass = '.Rawlh' - extVersionCode = 1 - extVersionSuffix = 1 - libVersion = '1.1' + extVersionCode = 2 + extVersionSuffix = 0 + libVersion = '1.2' } apply from: "$rootDir/common.gradle"