mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 07:51:52 +01:00
Kitsu: include manga instead of media
This commit is contained in:
parent
a03dceff7d
commit
6ef94fb59b
@ -88,12 +88,10 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
|||||||
fun findLibManga(track: Track, userId: String): Observable<Track?> {
|
fun findLibManga(track: Track, userId: String): Observable<Track?> {
|
||||||
return rest.findLibManga(track.remote_id, userId)
|
return rest.findLibManga(track.remote_id, userId)
|
||||||
.map { json ->
|
.map { json ->
|
||||||
val data = json["data"].array.filter {
|
val data = json["data"].array
|
||||||
it["relationships"]["media"]["data"]["type"].string == "manga"
|
if (data.size() > 0) {
|
||||||
}
|
val manga = json["included"].array[0].obj
|
||||||
if (data.isNotEmpty()) {
|
KitsuLibManga(data[0].obj, manga).toTrack()
|
||||||
val media = json["included"].array.first { it["type"].string == "manga" }.obj
|
|
||||||
KitsuLibManga(data[0].obj, media).toTrack()
|
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
@ -105,8 +103,8 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
|
|||||||
.map { json ->
|
.map { json ->
|
||||||
val data = json["data"].array
|
val data = json["data"].array
|
||||||
if (data.size() > 0) {
|
if (data.size() > 0) {
|
||||||
val include = json["included"].array[0].obj
|
val manga = json["included"].array[0].obj
|
||||||
KitsuLibManga(data[0].obj, include).toTrack()
|
KitsuLibManga(data[0].obj, manga).toTrack()
|
||||||
} else {
|
} else {
|
||||||
throw Exception("Could not find manga")
|
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[media_id]", encoded = true) remoteId: Int,
|
||||||
@Query("filter[user_id]", encoded = true) userId: String,
|
@Query("filter[user_id]", encoded = true) userId: String,
|
||||||
@Query("page[limit]", encoded = true) limit: Int = 10000,
|
@Query("page[limit]", encoded = true) limit: Int = 10000,
|
||||||
@Query("include") includes: String = "media"
|
@Query("include") includes: String = "manga"
|
||||||
): Observable<JsonObject>
|
): Observable<JsonObject>
|
||||||
|
|
||||||
@GET("library-entries")
|
@GET("library-entries")
|
||||||
fun getLibManga(
|
fun getLibManga(
|
||||||
@Query("filter[id]", encoded = true) remoteId: Int,
|
@Query("filter[id]", encoded = true) remoteId: Int,
|
||||||
@Query("include") includes: String = "media"
|
@Query("include") includes: String = "manga"
|
||||||
): Observable<JsonObject>
|
): Observable<JsonObject>
|
||||||
|
|
||||||
@GET("users")
|
@GET("users")
|
||||||
|
Loading…
Reference in New Issue
Block a user