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 get<'v, V>(&'v self, key: &str) -> Option<Result<&'v V>>
pub fn get<'v, V>(&'v self, key: &str) -> Option<Result<&'v V>>
Returns the value corresponding to the key and convert it to V
.
sourcepub fn get_value(&self, key: &str) -> Option<&Value<'_>>
pub fn get_value(&self, key: &str) -> Option<&Value<'_>>
Returns a reference to the value corresponding to the key.
sourcepub fn set(
&mut self,
key: &str,
value: Option<impl Into<Value<'static>>>,
) -> Option<Value<'static>>
pub fn set( &mut self, key: &str, value: Option<impl Into<Value<'static>>>, ) -> Option<Value<'static>>
Replaces the value for the given key and returns the previous value, if any.
The entry is removed if the given value is None
.
sourcepub fn set_value(
&mut self,
key: &str,
value: Option<Value<'static>>,
) -> Option<Value<'static>>
pub fn set_value( &mut self, key: &str, value: Option<Value<'static>>, ) -> Option<Value<'static>>
Replaces the value for the given key and returns the previous value, if any.
The entry is removed if the given value is None
.
This behaves like Metadata::set
, but this takes a [enum@Value
]
instead of a generic type.
sourcepub fn trackid(&self) -> Option<TrackId>
pub fn trackid(&self) -> Option<TrackId>
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_trackid(&mut self, trackid: Option<impl Into<TrackId>>)
pub fn set_trackid(&mut self, trackid: Option<impl Into<TrackId>>)
Sets 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: Option<Time>)
pub fn set_length(&mut self, length: Option<Time>)
Sets the duration of the track.
sourcepub fn art_url(&self) -> Option<Uri>
pub fn art_url(&self) -> Option<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_art_url(&mut self, art_url: Option<impl Into<Uri>>)
pub fn set_art_url(&mut self, art_url: Option<impl Into<Uri>>)
Sets 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 album_artist(&self) -> Option<Vec<String>>
pub fn album_artist(&self) -> Option<Vec<String>>
The album artist(s).
sourcepub fn set_album_artist(
&mut self,
album_artist: Option<impl IntoIterator<Item = impl Into<String>>>,
)
pub fn set_album_artist( &mut self, album_artist: Option<impl IntoIterator<Item = impl Into<String>>>, )
Sets the album artist(s).
sourcepub fn set_artist(
&mut self,
artist: Option<impl IntoIterator<Item = impl Into<String>>>,
)
pub fn set_artist( &mut self, artist: Option<impl IntoIterator<Item = impl Into<String>>>, )
Sets the track artist(s).
sourcepub fn set_lyrics(&mut self, lyrics: Option<impl Into<String>>)
pub fn set_lyrics(&mut self, lyrics: Option<impl Into<String>>)
Sets the track lyrics.
sourcepub fn set_audio_bpm(&mut self, audio_bpm: Option<i32>)
pub fn set_audio_bpm(&mut self, audio_bpm: Option<i32>)
Sets the speed of the music, in beats per minute.
sourcepub fn auto_rating(&self) -> Option<f64>
pub fn auto_rating(&self) -> Option<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_auto_rating(&mut self, auto_rating: Option<f64>)
pub fn set_auto_rating(&mut self, auto_rating: Option<f64>)
Sets 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: Option<impl IntoIterator<Item = impl Into<String>>>,
)
pub fn set_comment( &mut self, comment: Option<impl IntoIterator<Item = impl Into<String>>>, )
Sets a (list of) freeform comment(s).
sourcepub fn set_composer(
&mut self,
composer: Option<impl IntoIterator<Item = impl Into<String>>>,
)
pub fn set_composer( &mut self, composer: Option<impl IntoIterator<Item = impl Into<String>>>, )
Sets the composer(s) of the track.
sourcepub fn content_created(&self) -> Option<DateTime>
pub fn content_created(&self) -> Option<DateTime>
When the track was created. Usually only the year component will be useful.
sourcepub fn set_content_created(
&mut self,
content_created: Option<impl Into<DateTime>>,
)
pub fn set_content_created( &mut self, content_created: Option<impl Into<DateTime>>, )
Sets when the track was created. Usually only the year component will be useful.
sourcepub fn disc_number(&self) -> Option<i32>
pub fn disc_number(&self) -> Option<i32>
The disc number on the album that this track is from.
sourcepub fn set_disc_number(&mut self, disc_number: Option<i32>)
pub fn set_disc_number(&mut self, disc_number: Option<i32>)
Sets the disc number on the album that this track is from.
sourcepub fn first_used(&self) -> Option<DateTime>
pub fn first_used(&self) -> Option<DateTime>
When the track was first played.
sourcepub fn set_first_used(&mut self, first_used: Option<impl Into<DateTime>>)
pub fn set_first_used(&mut self, first_used: Option<impl Into<DateTime>>)
Sets when the track was first played.
sourcepub fn set_genre(
&mut self,
genre: Option<impl IntoIterator<Item = impl Into<String>>>,
)
pub fn set_genre( &mut self, genre: Option<impl IntoIterator<Item = impl Into<String>>>, )
Sets the genre(s) of the track.
sourcepub fn set_last_used(&mut self, last_used: Option<impl Into<DateTime>>)
pub fn set_last_used(&mut self, last_used: Option<impl Into<DateTime>>)
Sets when the track was last played.
sourcepub fn set_lyricist(
&mut self,
lyricist: Option<impl IntoIterator<Item = impl Into<String>>>,
)
pub fn set_lyricist( &mut self, lyricist: Option<impl IntoIterator<Item = impl Into<String>>>, )
Sets the lyricist(s) of the track.
sourcepub fn track_number(&self) -> Option<i32>
pub fn track_number(&self) -> Option<i32>
The track number on the album disc.
sourcepub fn set_track_number(&mut self, track_number: Option<i32>)
pub fn set_track_number(&mut self, track_number: Option<i32>)
Sets the track number on the album disc.
sourcepub fn set_use_count(&mut self, use_count: Option<i32>)
pub fn set_use_count(&mut self, use_count: Option<i32>)
Sets the number of times the track has been played.
sourcepub fn user_rating(&self) -> Option<f64>
pub fn user_rating(&self) -> Option<f64>
A user-specified rating. This should be in the range 0.0 to 1.0.
sourcepub fn set_user_rating(&mut self, user_rating: Option<f64>)
pub fn set_user_rating(&mut self, user_rating: Option<f64>)
Sets a user-specified rating. This should be in the range 0.0 to 1.0.
Trait Implementations§
impl StructuralPartialEq for Metadata
Auto Trait Implementations§
impl Freeze for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnwindSafe for Metadata
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)