diff --git a/src/all/mangadex/build.gradle b/src/all/mangadex/build.gradle index 076f4daa0..fb3592752 100644 --- a/src/all/mangadex/build.gradle +++ b/src/all/mangadex/build.gradle @@ -5,8 +5,8 @@ ext { appName = 'Tachiyomi: MangaDex' pkgNameSuffix = "all.mangadex" extClass = '.MangadexFactory' - extVersionCode = 8 - extVersionSuffix = 8 + extVersionCode = 9 + extVersionSuffix = 9 libVersion = '1.2' } diff --git a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt index 8fead9402..ba68f0c92 100644 --- a/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt +++ b/src/all/mangadex/src/eu/kanade/tachiyomi/extension/all/mangadex/Mangadex.kt @@ -14,6 +14,7 @@ import org.jsoup.nodes.Element import rx.Observable import java.net.URLEncoder import java.text.SimpleDateFormat +import java.util.* import java.util.concurrent.TimeUnit open class Mangadex(override val lang: String, private val internalLang: String, val pageStart: Int) : ParsedHttpSource() { @@ -200,10 +201,15 @@ open class Mangadex(override val lang: String, private val internalLang: String, var document = response.asJsoup() val baseUri = baseUrl + document.select("li.paging a").first()?.attr("href")?.substringBeforeLast("/") var page = 1 + val now = Date().time val chapters = mutableListOf() do { document.select(chapterListSelector()).forEach { - chapters.add(chapterFromElement(it)) + val chapterFromElement = chapterFromElement(it) + //ignore chapters that are on the site but have a future date because scanlator has a delay set + if (chapterFromElement.date_upload <= now) { + chapters.add(chapterFromElement) + } } val nextPage = hasNextPage(document) if (nextPage) { @@ -234,7 +240,9 @@ open class Mangadex(override val lang: String, private val internalLang: String, } private fun parseChapterDate(date: String): Long { - return SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse(date).time + val dateFormat = SimpleDateFormat("yyyy-MM-dd hh:mm:ss") + dateFormat.timeZone = TimeZone.getTimeZone("UTC") + return dateFormat.parse(date).time } override fun pageListParse(document: Document): List { @@ -264,7 +272,7 @@ open class Mangadex(override val lang: String, private val internalLang: String, else -> SManga.UNKNOWN } - fun getImageUrl(attr: String): String { + private fun getImageUrl(attr: String): String { //some images are hosted elsewhere if (attr.startsWith("http")) { return attr