pub struct PlayerMetadata<'a> { /* private fields */ }Expand description
Represents the metadata of an MPRIS media player.
This struct stores key-value pairs of metadata properties retrieved from an MPRIS-compatible player. Metadata includes information such as track title, artist, album, playback details, etc.
Implementations§
Source§impl<'a> PlayerMetadata<'a>
impl<'a> PlayerMetadata<'a>
Sourcepub fn new(metadata: HashMap<String, Value<'a>>) -> Self
pub fn new(metadata: HashMap<String, Value<'a>>) -> Self
Creates a new PlayerMetadata instance from a given metadata HashMap.
You’d typically will not be creating new metadata yourselve and interact
On the one from the crate::player::MprisPlayer
§Arguments
metadata- AHashMap<String, zvariant::Value<'a>>containing metadata key-value pairs.
Sourcepub fn track_id(&self) -> MprisResult<Option<TrackId>>
pub fn track_id(&self) -> MprisResult<Option<TrackId>>
Metadata mpris:trackid.
Returns Err when mpris:trackid is somehow a different type. Returns None when mpris:trackid doesn’t exists.
Sourcepub fn title(&self) -> MprisResult<Option<String>>
pub fn title(&self) -> MprisResult<Option<String>>
Metadata xesam:title.
Returns Err when xesam:title is somehow a different type. Returns None when xesam:title doesn’t exists.
Sourcepub fn album(&self) -> MprisResult<Option<String>>
pub fn album(&self) -> MprisResult<Option<String>>
Metadata xesam:album.
Returns Err when xesam:album is somehow a different type. Returns None when xesam:album doesn’t exists.
Sourcepub fn artists(&self) -> MprisResult<Option<Vec<String>>>
pub fn artists(&self) -> MprisResult<Option<Vec<String>>>
Metadata xesam:artist.
Returns Err when xesam:artist is somehow a different type. Returns None when xesam:artist doesn’t exists.
Sourcepub fn length(&self) -> MprisResult<Option<Duration>>
pub fn length(&self) -> MprisResult<Option<Duration>>
Metadata mpris:length.
Returns Err when mpris:length is somehow a different type. Returns None when mpris:length doesn’t exists.
Sourcepub fn art_url(&self) -> MprisResult<Option<String>>
pub fn art_url(&self) -> MprisResult<Option<String>>
Metadata mpris:artUrl.
Returns Err when mpris:artUrl is somehow a different type. Returns None when mpris:artUrl doesn’t exists.