mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 20:31:51 +01:00
Kitsu search fix (#1524)
* fixed start date, fixed filtering of novel * removed init switched ?.let
This commit is contained in:
parent
515289134e
commit
762c378bd6
@ -6,17 +6,23 @@ import com.google.gson.JsonObject
|
||||
import eu.kanade.tachiyomi.data.database.models.Track
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
|
||||
class KitsuSearchManga(obj: JsonObject) {
|
||||
val id by obj.byInt
|
||||
private val canonicalTitle by obj.byString
|
||||
private val chapterCount = obj.get("chapterCount").nullInt
|
||||
val subType = obj.get("subType").nullString
|
||||
val subType = obj.get("subtype").nullString
|
||||
val original by obj["posterImage"].byString
|
||||
private val synopsis by obj.byString
|
||||
private val startDate = obj.get("startDate").nullString
|
||||
private var startDate = obj.get("startDate").nullString?.let {
|
||||
val outputDf = SimpleDateFormat("yyyy-MM-dd", Locale.US)
|
||||
outputDf.format(Date(it!!.toLong() * 1000))
|
||||
}
|
||||
private val endDate = obj.get("endDate").nullString
|
||||
|
||||
|
||||
@CallSuper
|
||||
open fun toTrack() = TrackSearch.create(TrackManager.KITSU).apply {
|
||||
media_id = this@KitsuSearchManga.id
|
||||
@ -25,14 +31,13 @@ class KitsuSearchManga(obj: JsonObject) {
|
||||
cover_url = original
|
||||
summary = synopsis
|
||||
tracking_url = KitsuApi.mangaUrl(media_id)
|
||||
|
||||
if (endDate == null) {
|
||||
publishing_status = "Publishing"
|
||||
} else {
|
||||
publishing_status = "Finished"
|
||||
}
|
||||
publishing_type = subType ?: ""
|
||||
start_date = startDate.orEmpty()
|
||||
start_date = startDate ?: ""
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user