From 24bdee626fa38d224522706f96b7813059359b35 Mon Sep 17 00:00:00 2001 From: Gilfar Date: Fri, 9 Sep 2016 19:20:24 +0200 Subject: [PATCH] parse manga from the future (#458) --- .../tachiyomi/data/source/online/english/Mangasee.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/english/Mangasee.kt b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/english/Mangasee.kt index 118cf212c6..a53eee06c2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/source/online/english/Mangasee.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/source/online/english/Mangasee.kt @@ -22,7 +22,7 @@ class Mangasee(context: Context, override val id: Int) : ParsedOnlineSource(cont override val lang: Language get() = EN - private val datePattern = Pattern.compile("(\\d+)\\s+(.*?)s? ago.*") + private val datePattern = Pattern.compile("(\\d+)\\s+(.*?)s? (from now|ago).*") private val dateFields = HashMap().apply { put("second", Calendar.SECOND) @@ -34,6 +34,11 @@ class Mangasee(context: Context, override val id: Int) : ParsedOnlineSource(cont put("year", Calendar.YEAR) } + private val dateRelationFields = HashMap().apply { + put("from now", 1) + put("ago", -1) + } + override fun popularMangaInitialUrl() = "$baseUrl/search_result.php?Action=Yes&order=popularity&numResultPerPage=20&sort=desc" override fun popularMangaSelector() = "div.well > table > tbody > tr" @@ -93,9 +98,10 @@ class Mangasee(context: Context, override val id: Int) : ParsedOnlineSource(cont if (m.matches()) { val amount = Integer.parseInt(m.group(1)) val unit = m.group(2) + val relation = m.group(3) return Calendar.getInstance().apply { - add(dateFields[unit]!!, -amount) + add(dateFields[unit]!!, dateRelationFields[relation]!! * amount) }.time.time } else { return 0