MCPcopy Create free account
hub / github.com/Moosync/Moosync / set_metadata

Function set_metadata

src/utils/mpris.rs:25–42  ·  view source on GitHub ↗
(song: &Song)

Source from the content-addressed store, hash-verified

23
24#[tracing::instrument(level = "debug", skip(song))]
25pub fn set_metadata(song: &Song) {
26 let metadata = MprisPlayerDetails {
27 title: song.song.title.clone(),
28 id: song.song._id.clone(),
29 artist_name: Some(get_artist_string(song.artists.clone())),
30 album_name: song.album.clone().map(|a| a.album_name.unwrap_or_default()),
31 album_artist: None,
32 genres: None,
33 duration: song.song.duration,
34 thumbnail: song.song.song_cover_path_high.clone(),
35 };
36 spawn_local(async move {
37 let res = crate::utils::invoke::set_metadata(metadata).await;
38 if let Err(err) = res {
39 tracing::error!("Failed to set mpris metadata {:?}", err);
40 }
41 })
42}
43
44#[tracing::instrument(level = "debug", skip(state))]
45pub fn set_playback_state(state: PlayerState) {

Callers 1

AudioStreamFunction · 0.85

Calls 2

get_artist_stringFunction · 0.85
cloneMethod · 0.80

Tested by

no test coverage detected