managdex ignore future chapters (#223)
This commit is contained in:
parent
367be55c10
commit
12a6c7b459
|
@ -5,8 +5,8 @@ ext {
|
||||||
appName = 'Tachiyomi: MangaDex'
|
appName = 'Tachiyomi: MangaDex'
|
||||||
pkgNameSuffix = "all.mangadex"
|
pkgNameSuffix = "all.mangadex"
|
||||||
extClass = '.MangadexFactory'
|
extClass = '.MangadexFactory'
|
||||||
extVersionCode = 8
|
extVersionCode = 9
|
||||||
extVersionSuffix = 8
|
extVersionSuffix = 9
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.jsoup.nodes.Element
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
|
|
||||||
open class Mangadex(override val lang: String, private val internalLang: String, val pageStart: Int) : ParsedHttpSource() {
|
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()
|
var document = response.asJsoup()
|
||||||
val baseUri = baseUrl + document.select("li.paging a").first()?.attr("href")?.substringBeforeLast("/")
|
val baseUri = baseUrl + document.select("li.paging a").first()?.attr("href")?.substringBeforeLast("/")
|
||||||
var page = 1
|
var page = 1
|
||||||
|
val now = Date().time
|
||||||
val chapters = mutableListOf<SChapter>()
|
val chapters = mutableListOf<SChapter>()
|
||||||
do {
|
do {
|
||||||
document.select(chapterListSelector()).forEach {
|
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)
|
val nextPage = hasNextPage(document)
|
||||||
if (nextPage) {
|
if (nextPage) {
|
||||||
|
@ -234,7 +240,9 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parseChapterDate(date: String): Long {
|
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<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
|
@ -264,7 +272,7 @@ open class Mangadex(override val lang: String, private val internalLang: String,
|
||||||
else -> SManga.UNKNOWN
|
else -> SManga.UNKNOWN
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getImageUrl(attr: String): String {
|
private fun getImageUrl(attr: String): String {
|
||||||
//some images are hosted elsewhere
|
//some images are hosted elsewhere
|
||||||
if (attr.startsWith("http")) {
|
if (attr.startsWith("http")) {
|
||||||
return attr
|
return attr
|
||||||
|
|
Loading…
Reference in New Issue