Struct mpris_server::Metadata
source · pub struct Metadata(/* private fields */);Expand description
A mapping from metadata attribute names to values.
The mpris:trackid attribute must always be present.
If the length of the track is known, it should be provided in the metadata
property with the mpris:length key.
If there is an image associated with the track, a URL for it may be provided
using the mpris:artUrl key.
Implementations§
source§impl Metadata
impl Metadata
sourcepub fn builder() -> MetadataBuilder
pub fn builder() -> MetadataBuilder
Creates a new builder-pattern struct instance to construct Metadata.
sourcepub fn insert(
&mut self,
key: impl Into<String>,
value: impl Into<Value<'static>>
) -> Option<Value<'static>>
pub fn insert( &mut self, key: impl Into<String>, value: impl Into<Value<'static>> ) -> Option<Value<'static>>
Insert a new key-value pair into the metadata.
This will overwrite any existing value for the given key and will return the old value, if any.
sourcepub fn get<'v, V>(&'v self, key: &str) -> Option<Result<&'v V>>where
&'v V: TryFrom<&'v Value<'v>>,
pub fn get<'v, V>(&'v self, key: &str) -> Option<Result<&'v V>>where &'v V: TryFrom<&'v Value<'v>>,
Get the value of the given key and convert it to V, if it exists.
sourcepub fn get_value(&self, key: &str) -> Option<&Value<'_>>
pub fn get_value(&self, key: &str) -> Option<&Value<'_>>
Get the value of the given key, if it exists.
sourcepub fn set_trackid(&mut self, trackid: impl Into<OwnedObjectPath>)
pub fn set_trackid(&mut self, trackid: impl Into<OwnedObjectPath>)
A unique identity for this track within the context of an MPRIS object (eg: tracklist).
This contains a D-Bus path that uniquely identifies the track within the scope of the playlist. There may or may not be an actual D-Bus object at that path; this specification says nothing about what interfaces such an object may implement.
sourcepub fn set_length(&mut self, length: Time)
pub fn set_length(&mut self, length: Time)
The duration of the track in microseconds.
sourcepub fn set_art_url(&mut self, art_url: impl Into<Uri>)
pub fn set_art_url(&mut self, art_url: impl Into<Uri>)
The location of an image representing the track or album.
Clients should not assume this will continue to exist when the media player stops giving out the URL.
sourcepub fn set_album_artist(
&mut self,
album_artist: impl IntoIterator<Item = impl Into<String>>
)
pub fn set_album_artist( &mut self, album_artist: impl IntoIterator<Item = impl Into<String>> )
The album artist(s).
sourcepub fn set_artist(
&mut self,
artist: impl IntoIterator<Item = impl Into<String>>
)
pub fn set_artist( &mut self, artist: impl IntoIterator<Item = impl Into<String>> )
The track artist(s).
sourcepub fn set_lyrics(&mut self, lyrics: impl Into<String>)
pub fn set_lyrics(&mut self, lyrics: impl Into<String>)
The track lyrics.
sourcepub fn set_audio_bpm(&mut self, audio_bpm: i32)
pub fn set_audio_bpm(&mut self, audio_bpm: i32)
The speed of the music, in beats per minute.
sourcepub fn set_auto_rating(&mut self, auto_rating: f64)
pub fn set_auto_rating(&mut self, auto_rating: f64)
An automatically-generated rating, based on things such as how often it has been played. This should be in the range 0.0 to 1.0.
sourcepub fn set_comment(
&mut self,
comment: impl IntoIterator<Item = impl Into<String>>
)
pub fn set_comment( &mut self, comment: impl IntoIterator<Item = impl Into<String>> )
A (list of) freeform comment(s).
sourcepub fn set_composer(
&mut self,
composer: impl IntoIterator<Item = impl Into<String>>
)
pub fn set_composer( &mut self, composer: impl IntoIterator<Item = impl Into<String>> )
The composer(s) of the track.
sourcepub fn set_content_created(&mut self, content_created: impl Into<DateTime>)
pub fn set_content_created(&mut self, content_created: impl Into<DateTime>)
When the track was created. Usually only the year component will be useful.
sourcepub fn set_disc_number(&mut self, disc_number: i32)
pub fn set_disc_number(&mut self, disc_number: i32)
The disc number on the album that this track is from.
sourcepub fn set_first_used(&mut self, first_used: impl Into<DateTime>)
pub fn set_first_used(&mut self, first_used: impl Into<DateTime>)
When the track was first played.
sourcepub fn set_genre(&mut self, genre: impl IntoIterator<Item = impl Into<String>>)
pub fn set_genre(&mut self, genre: impl IntoIterator<Item = impl Into<String>>)
The genre(s) of the track.
sourcepub fn set_last_used(&mut self, last_used: impl Into<DateTime>)
pub fn set_last_used(&mut self, last_used: impl Into<DateTime>)
When the track was last played.
sourcepub fn set_lyricist(
&mut self,
lyricist: impl IntoIterator<Item = impl Into<String>>
)
pub fn set_lyricist( &mut self, lyricist: impl IntoIterator<Item = impl Into<String>> )
The lyricist(s) of the track.
sourcepub fn set_track_number(&mut self, track_number: i32)
pub fn set_track_number(&mut self, track_number: i32)
The track number on the album disc.
sourcepub fn set_use_count(&mut self, use_count: i32)
pub fn set_use_count(&mut self, use_count: i32)
The number of times the track has been played.
sourcepub fn set_user_rating(&mut self, user_rating: f64)
pub fn set_user_rating(&mut self, user_rating: f64)
A user-specified rating. This should be in the range 0.0 to 1.0.