diff --git a/lib/data_source/jellyfin_api.ml b/lib/data_source/jellyfin_api.ml index 7bcc5e1..9edbe86 100644 --- a/lib/data_source/jellyfin_api.ml +++ b/lib/data_source/jellyfin_api.ml @@ -198,7 +198,10 @@ module Item = struct id : string; [@key "Id"] path : string option; [@yojson.option] [@key "Path"] album_id : string option; [@yojson.option] [@key "AlbumId"] - parent_id : string option; [@yojson.option] [@key "ParentId"] + parent_id : string option option; + (* [ParentId] might absent, [null], or a string *) + [@yojson.option] + [@key "ParentId"] server_id : string; [@key "ServerId"] image_blur_hashes : image_blur_hashes; [@key "ImageBlurHashes"] type_ : type_str; [@key "Type"] @@ -345,7 +348,6 @@ let request (type pp p r) ?base_url ?token ?headers let yojson = Yojson.Safe.from_string (Jstr.to_string json) in try Q.response_of_yojson yojson with e -> - Console.log - [ "An error occured while decoding the following response: "; yojson ]; + Console.log [ "An error occured while decoding response: "; json ]; Console.log [ e ]; raise e diff --git a/lib/db/sync.ml b/lib/db/sync.ml index 6412b2b..4d72b9f 100644 --- a/lib/db/sync.ml +++ b/lib/db/sync.ml @@ -217,7 +217,9 @@ let deduce_virtual_folders_from_views source (views : Views.response) = in List.fold_left ~init:String.Set.empty res.items ~f:(fun set { Item.parent_id; _ } -> - match parent_id with None -> set | Some pid -> String.Set.add pid set) + match parent_id with + | None | Some None -> set + | Some (Some pid) -> String.Set.add pid set) in let paths_of_parents parents = let+ res =