TimelessLeaf add chapter timeStamp (#5078)
* TimelessLeaf add chapter timeStamp * add spacing
This commit is contained in:
parent
8b55fd8734
commit
9e9b326c49
|
@ -5,7 +5,7 @@ ext {
|
|||
extName = 'TimelessLeaf'
|
||||
pkgNameSuffix = 'en.timelessleaf'
|
||||
extClass = '.TimelessLeaf'
|
||||
extVersionCode = 2
|
||||
extVersionCode = 3
|
||||
libVersion = '1.2'
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.util.asJsoup
|
|||
import okhttp3.Request
|
||||
import okhttp3.Response
|
||||
import rx.Observable
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
|
@ -28,6 +29,8 @@ class TimelessLeaf : HttpSource() {
|
|||
|
||||
override val supportsLatest: Boolean = false
|
||||
|
||||
private val dateFormat: SimpleDateFormat = SimpleDateFormat("yyyy/MM/dd", Locale.US)
|
||||
|
||||
// popular manga
|
||||
|
||||
override fun popularMangaRequest(page: Int): Request {
|
||||
|
@ -100,11 +103,25 @@ class TimelessLeaf : HttpSource() {
|
|||
return hostedHere.map { el ->
|
||||
SChapter.create().apply {
|
||||
setUrlWithoutDomain(el.attr("href"))
|
||||
// taking timeStamp from url
|
||||
date_upload = parseChapterDate(el.attr("href").substringAfter("com/").substringAfter("php/"))
|
||||
name = el.text()
|
||||
}
|
||||
}.asReversed()
|
||||
}
|
||||
|
||||
private fun parseChapterDate(date: String): Long {
|
||||
return try {
|
||||
dateFormat.parse(date)?.time ?: 0
|
||||
} catch (_: Exception) {
|
||||
0L
|
||||
}
|
||||
}
|
||||
|
||||
private fun parseDate(date: String): Long {
|
||||
return SimpleDateFormat("yyyy/MM/dd", Locale.ENGLISH).parse(date)?.time ?: 0L
|
||||
}
|
||||
|
||||
// page list
|
||||
|
||||
override fun pageListParse(response: Response): List<Page> {
|
||||
|
|
Loading…
Reference in New Issue