Skip to content

Commit

Permalink
fix media session album cover
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos committed Apr 26, 2024
1 parent 204b875 commit be0f00a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bin/player.ml
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,19 @@ struct
let+ result = P.fetch playlist [| current_index |] in
match result with
| [| Some { Db.Stores.Items.item; _ } |] ->
let { DS.Api.Item.server_id; id; name; _ } = item in
let { DS.Api.Item.server_id; id; album_id; name; _ } = item in
let servers = Lwd_seq.to_list (Lwd.peek Servers.connexions) in
let connexion : DS.connexion = List.assq server_id servers in
let url = audio_url connexion id in
let () = Console.log [ "Now playing:"; name; Jv.of_string url ] in
let () =
let open Brr_io.Media.Session in
let session = of_navigator G.navigator in
let image_id = Option.value ~default:id album_id in
let img_src =
Printf.sprintf "%s/Items/%s/Images/Primary?width=500"
connexion.base_url id
Printf.sprintf
"%s/Items/%s/Images/Primary?width=500&format=Jpg"
connexion.base_url image_id
in
let title = name in
let album = "" in
Expand All @@ -67,10 +69,11 @@ struct
{
Media_metadata.src = img_src;
sizes = "500x500";
type' = "";
type' = "image/jpeg";
};
]
in
Console.log [ artwork ];
set_metadata session { title; artist; album; artwork }
in
{ item; url }
Expand Down

0 comments on commit be0f00a

Please sign in to comment.