From 6ef94fb59bef64b3def2864205a84a611195655b Mon Sep 17 00:00:00 2001 From: len Date: Thu, 12 Jan 2017 15:38:42 +0100 Subject: [PATCH] Kitsu: include manga instead of media --- .../tachiyomi/data/track/kitsu/KitsuApi.kt | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt index 65d7c2d88..5f2426755 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/track/kitsu/KitsuApi.kt @@ -88,12 +88,10 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor) fun findLibManga(track: Track, userId: String): Observable { return rest.findLibManga(track.remote_id, userId) .map { json -> - val data = json["data"].array.filter { - it["relationships"]["media"]["data"]["type"].string == "manga" - } - if (data.isNotEmpty()) { - val media = json["included"].array.first { it["type"].string == "manga" }.obj - KitsuLibManga(data[0].obj, media).toTrack() + val data = json["data"].array + if (data.size() > 0) { + val manga = json["included"].array[0].obj + KitsuLibManga(data[0].obj, manga).toTrack() } else { null } @@ -105,8 +103,8 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor) .map { json -> val data = json["data"].array if (data.size() > 0) { - val include = json["included"].array[0].obj - KitsuLibManga(data[0].obj, include).toTrack() + val manga = json["included"].array[0].obj + KitsuLibManga(data[0].obj, manga).toTrack() } else { throw Exception("Could not find manga") } @@ -153,13 +151,13 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor) @Query("filter[media_id]", encoded = true) remoteId: Int, @Query("filter[user_id]", encoded = true) userId: String, @Query("page[limit]", encoded = true) limit: Int = 10000, - @Query("include") includes: String = "media" + @Query("include") includes: String = "manga" ): Observable @GET("library-entries") fun getLibManga( @Query("filter[id]", encoded = true) remoteId: Int, - @Query("include") includes: String = "media" + @Query("include") includes: String = "manga" ): Observable @GET("users")