From 762c378bd61d7e2e3adbaf17aaa03b14c2597ee9 Mon Sep 17 00:00:00 2001 From: Carlos Date: Sat, 7 Jul 2018 05:35:03 -0400 Subject: [PATCH] Kitsu search fix (#1524) * fixed start date, fixed filtering of novel * removed init switched ?.let --- .../tachiyomi/data/track/kitsu/KitsuModels.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt index 5334b0cd4a..bdc82cd820 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuModels.kt @@ -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 ?: "" } }