mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-17 16:09:16 +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.database.models.Track
|
||||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||||
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
import eu.kanade.tachiyomi.data.track.model.TrackSearch
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
class KitsuSearchManga(obj: JsonObject) {
|
class KitsuSearchManga(obj: JsonObject) {
|
||||||
val id by obj.byInt
|
val id by obj.byInt
|
||||||
private val canonicalTitle by obj.byString
|
private val canonicalTitle by obj.byString
|
||||||
private val chapterCount = obj.get("chapterCount").nullInt
|
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
|
val original by obj["posterImage"].byString
|
||||||
private val synopsis by obj.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
|
private val endDate = obj.get("endDate").nullString
|
||||||
|
|
||||||
|
|
||||||
@CallSuper
|
@CallSuper
|
||||||
open fun toTrack() = TrackSearch.create(TrackManager.KITSU).apply {
|
open fun toTrack() = TrackSearch.create(TrackManager.KITSU).apply {
|
||||||
media_id = this@KitsuSearchManga.id
|
media_id = this@KitsuSearchManga.id
|
||||||
@ -25,14 +31,13 @@ class KitsuSearchManga(obj: JsonObject) {
|
|||||||
cover_url = original
|
cover_url = original
|
||||||
summary = synopsis
|
summary = synopsis
|
||||||
tracking_url = KitsuApi.mangaUrl(media_id)
|
tracking_url = KitsuApi.mangaUrl(media_id)
|
||||||
|
|
||||||
if (endDate == null) {
|
if (endDate == null) {
|
||||||
publishing_status = "Publishing"
|
publishing_status = "Publishing"
|
||||||
} else {
|
} else {
|
||||||
publishing_status = "Finished"
|
publishing_status = "Finished"
|
||||||
}
|
}
|
||||||
publishing_type = subType ?: ""
|
publishing_type = subType ?: ""
|
||||||
start_date = startDate.orEmpty()
|
start_date = startDate ?: ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user