fix cubari upload date (#8126)

* fix upload date

* change sketchy method
This commit is contained in:
Seishirou101 2021-07-17 13:52:25 -05:00 committed by GitHub
parent 532396e197
commit aea0eb6daf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -6,7 +6,7 @@ ext {
extName = 'Cubari' extName = 'Cubari'
pkgNameSuffix = "all.cubari" pkgNameSuffix = "all.cubari"
extClass = '.CubariFactory' extClass = '.CubariFactory'
extVersionCode = 7 extVersionCode = 8
libVersion = '1.2' libVersion = '1.2'
} }

View File

@ -15,10 +15,10 @@ import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonArray import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.boolean import kotlinx.serialization.json.boolean
import kotlinx.serialization.json.double
import kotlinx.serialization.json.jsonArray import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.long
import okhttp3.Headers import okhttp3.Headers
import okhttp3.Request import okhttp3.Request
import okhttp3.Response import okhttp3.Response
@ -277,8 +277,9 @@ open class Cubari(override val lang: String) : HttpSource() {
scanlator = groups[groupNum]!!.jsonPrimitive.content scanlator = groups[groupNum]!!.jsonPrimitive.content
chapter_number = chapterNum.toFloatOrNull() ?: -1f chapter_number = chapterNum.toFloatOrNull() ?: -1f
date_upload = if (chapterObj["release_date"] != null) { if (chapterObj["release_date"]!!.jsonObject[groupNum] != null) {
chapterObj["release_date"]!!.jsonObject[groupNum]!!.jsonPrimitive.long * 1000 val temp = chapterObj["release_date"]!!.jsonObject[groupNum]!!.jsonPrimitive.double
date_upload = temp.toLong() * 1000
} else { } else {
val currentTimeMillis = System.currentTimeMillis() val currentTimeMillis = System.currentTimeMillis()
@ -286,7 +287,7 @@ open class Cubari(override val lang: String) : HttpSource() {
seriesPrefsEditor.putLong(chapterNum, currentTimeMillis) seriesPrefsEditor.putLong(chapterNum, currentTimeMillis)
} }
seriesPrefs.getLong(chapterNum, currentTimeMillis) date_upload = seriesPrefs.getLong(chapterNum, currentTimeMillis)
} }
name = if (volume.isNotEmpty() && volume != "Uncategorized") { name = if (volume.isNotEmpty() && volume != "Uncategorized") {
@ -358,11 +359,9 @@ open class Cubari(override val lang: String) : HttpSource() {
companion object { companion object {
const val PROXY_PREFIX = "cubari:" const val PROXY_PREFIX = "cubari:"
const val AUTHOR_FALLBACK = "Unknown" const val AUTHOR_FALLBACK = "Unknown"
const val ARTIST_FALLBACK = "Unknown" const val ARTIST_FALLBACK = "Unknown"
const val DESCRIPTION_FALLBACK = "No description." const val DESCRIPTION_FALLBACK = "No description."
const val SEARCH_FALLBACK_MSG = "Unable to parse. Is your query in the format of $PROXY_PREFIX<source>/<slug>?" const val SEARCH_FALLBACK_MSG = "Unable to parse. Is your query in the format of $PROXY_PREFIX<source>/<slug>?"
enum class SortType { enum class SortType {