Dynasty - fix date parsing (#4137)
This commit is contained in:
parent
8b3c2cc12f
commit
eff8246ee1
|
@ -5,7 +5,7 @@ ext {
|
||||||
extName = 'Dynasty'
|
extName = 'Dynasty'
|
||||||
pkgNameSuffix = 'en.dynasty'
|
pkgNameSuffix = 'en.dynasty'
|
||||||
extClass = '.DynastyFactory'
|
extClass = '.DynastyFactory'
|
||||||
extVersionCode = 11
|
extVersionCode = 12
|
||||||
libVersion = '1.2'
|
libVersion = '1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@ import eu.kanade.tachiyomi.source.model.FilterList
|
||||||
import eu.kanade.tachiyomi.source.model.SChapter
|
import eu.kanade.tachiyomi.source.model.SChapter
|
||||||
import eu.kanade.tachiyomi.source.model.SManga
|
import eu.kanade.tachiyomi.source.model.SManga
|
||||||
import eu.kanade.tachiyomi.util.asJsoup
|
import eu.kanade.tachiyomi.util.asJsoup
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.Locale
|
|
||||||
import okhttp3.Request
|
import okhttp3.Request
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import org.jsoup.nodes.Document
|
import org.jsoup.nodes.Document
|
||||||
|
@ -71,9 +69,7 @@ class DynastyChapters : DynastyScans() {
|
||||||
val chapter = SChapter.create()
|
val chapter = SChapter.create()
|
||||||
chapter.setUrlWithoutDomain(element.baseUri())
|
chapter.setUrlWithoutDomain(element.baseUri())
|
||||||
chapter.name = element.select("h3").text()
|
chapter.name = element.select("h3").text()
|
||||||
chapter.date_upload = element.select("span.released")?.first().let {
|
chapter.date_upload = element.select("span.released").firstOrNull()?.text().toDate("MMM dd, yyyy")
|
||||||
SimpleDateFormat("MMM dd, yy", Locale.ENGLISH).parse(it!!.text()).time
|
|
||||||
}
|
|
||||||
return chapter
|
return chapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -147,12 +147,22 @@ abstract class DynastyScans : ParsedHttpSource() {
|
||||||
chapter.name += " and ${nodes[nodes.indexOfPartial(" and ") + 1]}"
|
chapter.name += " and ${nodes[nodes.indexOfPartial(" and ") + 1]}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chapter.date_upload = nodes[nodes.indexOfPartial("released")].let {
|
chapter.date_upload = nodes[nodes.indexOfPartial("released")]
|
||||||
SimpleDateFormat("MMM dd yy", Locale.ENGLISH).parse(it.substringAfter("released ").replace("\'", "")).time
|
.substringAfter("released ")
|
||||||
}
|
.replace("\'", "")
|
||||||
|
.toDate("MMM dd yy")
|
||||||
return chapter
|
return chapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected fun String?.toDate(pattern: String): Long {
|
||||||
|
this ?: return 0
|
||||||
|
return try {
|
||||||
|
SimpleDateFormat(pattern, Locale.ENGLISH).parse(this)?.time ?: 0
|
||||||
|
} catch (_: Exception) {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun pageListParse(document: Document): List<Page> {
|
override fun pageListParse(document: Document): List<Page> {
|
||||||
val pages = mutableListOf<Page>()
|
val pages = mutableListOf<Page>()
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue