Fix TimeZone issues in HeanCMS (#14900)
* Fix TimeZone issues in HeanCMS. * Fix wrong date format pattern. * Remove unused import.
This commit is contained in:
parent
fd0a489887
commit
8ad7f97c8f
|
@ -5,6 +5,8 @@ import eu.kanade.tachiyomi.multisrc.heancms.HeanCms
|
||||||
import eu.kanade.tachiyomi.network.interceptor.rateLimitHost
|
import eu.kanade.tachiyomi.network.interceptor.rateLimitHost
|
||||||
import okhttp3.HttpUrl.Companion.toHttpUrl
|
import okhttp3.HttpUrl.Companion.toHttpUrl
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
class ReaperScans : HeanCms(
|
class ReaperScans : HeanCms(
|
||||||
"Reaper Scans",
|
"Reaper Scans",
|
||||||
|
@ -21,6 +23,10 @@ class ReaperScans : HeanCms(
|
||||||
|
|
||||||
override val coverPath: String = ""
|
override val coverPath: String = ""
|
||||||
|
|
||||||
|
override val dateFormat: SimpleDateFormat = super.dateFormat.apply {
|
||||||
|
timeZone = TimeZone.getTimeZone("GMT+01:00")
|
||||||
|
}
|
||||||
|
|
||||||
override fun getGenreList(): List<Genre> = listOf(
|
override fun getGenreList(): List<Genre> = listOf(
|
||||||
Genre("Artes Marciais", 2),
|
Genre("Artes Marciais", 2),
|
||||||
Genre("Aventura", 10),
|
Genre("Aventura", 10),
|
||||||
|
|
|
@ -2,6 +2,8 @@ package eu.kanade.tachiyomi.extension.es.yugenmangas
|
||||||
|
|
||||||
import eu.kanade.tachiyomi.multisrc.heancms.Genre
|
import eu.kanade.tachiyomi.multisrc.heancms.Genre
|
||||||
import eu.kanade.tachiyomi.multisrc.heancms.HeanCms
|
import eu.kanade.tachiyomi.multisrc.heancms.HeanCms
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.TimeZone
|
||||||
|
|
||||||
class YugenMangas : HeanCms("YugenMangas", "https://yugenmangas.com", "es") {
|
class YugenMangas : HeanCms("YugenMangas", "https://yugenmangas.com", "es") {
|
||||||
|
|
||||||
|
@ -10,6 +12,10 @@ class YugenMangas : HeanCms("YugenMangas", "https://yugenmangas.com", "es") {
|
||||||
|
|
||||||
override val coverPath: String = ""
|
override val coverPath: String = ""
|
||||||
|
|
||||||
|
override val dateFormat: SimpleDateFormat = super.dateFormat.apply {
|
||||||
|
timeZone = TimeZone.getTimeZone("UTC")
|
||||||
|
}
|
||||||
|
|
||||||
override fun getGenreList(): List<Genre> = listOf(
|
override fun getGenreList(): List<Genre> = listOf(
|
||||||
Genre("+18", 1),
|
Genre("+18", 1),
|
||||||
Genre("Acción", 36),
|
Genre("Acción", 36),
|
||||||
|
|
|
@ -21,6 +21,8 @@ import okhttp3.RequestBody.Companion.toRequestBody
|
||||||
import okhttp3.Response
|
import okhttp3.Response
|
||||||
import rx.Observable
|
import rx.Observable
|
||||||
import uy.kohesive.injekt.injectLazy
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.Locale
|
||||||
|
|
||||||
abstract class HeanCms(
|
abstract class HeanCms(
|
||||||
override val name: String,
|
override val name: String,
|
||||||
|
@ -41,6 +43,8 @@ abstract class HeanCms(
|
||||||
|
|
||||||
protected open val coverPath: String = "cover/"
|
protected open val coverPath: String = "cover/"
|
||||||
|
|
||||||
|
protected open val dateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", Locale.US)
|
||||||
|
|
||||||
private var seriesSlugMap: Map<String, HeanCmsTitle>? = null
|
private var seriesSlugMap: Map<String, HeanCmsTitle>? = null
|
||||||
|
|
||||||
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
override fun headersBuilder(): Headers.Builder = Headers.Builder()
|
||||||
|
@ -235,7 +239,7 @@ abstract class HeanCms(
|
||||||
val currentTimestamp = System.currentTimeMillis()
|
val currentTimestamp = System.currentTimeMillis()
|
||||||
|
|
||||||
return result.chapters.orEmpty()
|
return result.chapters.orEmpty()
|
||||||
.map { it.toSChapter(seriesSlug) }
|
.map { it.toSChapter(seriesSlug, dateFormat) }
|
||||||
.filter { it.date_upload <= currentTimestamp }
|
.filter { it.date_upload <= currentTimestamp }
|
||||||
.reversed()
|
.reversed()
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.Locale
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class HeanCmsQuerySearchDto(
|
data class HeanCmsQuerySearchDto(
|
||||||
|
@ -94,18 +93,12 @@ data class HeanCmsChapterDto(
|
||||||
@SerialName("created_at") val createdAt: String,
|
@SerialName("created_at") val createdAt: String,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
fun toSChapter(seriesSlug: String): SChapter = SChapter.create().apply {
|
fun toSChapter(seriesSlug: String, dateFormat: SimpleDateFormat): SChapter = SChapter.create().apply {
|
||||||
name = this@HeanCmsChapterDto.name.trim()
|
name = this@HeanCmsChapterDto.name.trim()
|
||||||
date_upload = runCatching { DATE_FORMAT.parse(createdAt.substringBefore("."))?.time }
|
date_upload = runCatching { dateFormat.parse(createdAt)?.time }
|
||||||
.getOrNull() ?: 0L
|
.getOrNull() ?: 0L
|
||||||
url = "/series/$seriesSlug/$slug#$id"
|
url = "/series/$seriesSlug/$slug#$id"
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
|
||||||
private val DATE_FORMAT by lazy {
|
|
||||||
SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
|
|
@ -9,7 +9,7 @@ class HeanCmsGenerator : ThemeSourceGenerator {
|
||||||
|
|
||||||
override val themeClass = "HeanCms"
|
override val themeClass = "HeanCms"
|
||||||
|
|
||||||
override val baseVersionCode: Int = 8
|
override val baseVersionCode: Int = 9
|
||||||
|
|
||||||
override val sources = listOf(
|
override val sources = listOf(
|
||||||
SingleLang("Reaper Scans", "https://reaperscans.net", "pt-BR", overrideVersionCode = 35),
|
SingleLang("Reaper Scans", "https://reaperscans.net", "pt-BR", overrideVersionCode = 35),
|
||||||
|
|
Loading…
Reference in New Issue