Filter manga library entries in Kitsu
Cette révision appartient à :
Parent
49d0e06704
révision
13bcefe5cd
1 fichiers modifiés avec 4 ajouts et 2 suppressions
|
@ -88,8 +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
|
val data = json["data"].array.filter {
|
||||||
if (data.size() > 0) {
|
it["relationships"]["media"]["data"]["type"].string == "manga"
|
||||||
|
}
|
||||||
|
if (data.isNotEmpty()) {
|
||||||
KitsuLibManga(data[0].obj, json["included"].array[0].obj).toTrack()
|
KitsuLibManga(data[0].obj, json["included"].array[0].obj).toTrack()
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
|
Référencer dans un nouveau ticket