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

source

pub fn new() -> Self

Creates an empty Metadata.

source

pub fn builder() -> MetadataBuilder

Creates a new builder-pattern struct instance to construct Metadata.

source

pub fn get<'v, V>(&'v self, key: &str) -> Option<Result<&'v V>>
where &'v V: TryFrom<&'v Value<'v>>, <&'v V as TryFrom<&'v Value<'v>>>::Error: Into<Error>,

Returns the value corresponding to the key and convert it to V.

source

pub fn get_value(&self, key: &str) -> Option<&Value<'_>>

Returns a reference to the value corresponding to the key.

source

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.

source

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.

source

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.

source

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.

source

pub fn length(&self) -> Option<Time>

The duration of the track.

source

pub fn set_length(&mut self, length: Option<Time>)

Sets the duration of the track.

source

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.

source

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.

source

pub fn album(&self) -> Option<&str>

The album name.

source

pub fn set_album(&mut self, album: Option<impl Into<String>>)

Sets the album name.

source

pub fn album_artist(&self) -> Option<Vec<String>>

The album artist(s).

source

pub fn set_album_artist( &mut self, album_artist: Option<impl IntoIterator<Item = impl Into<String>>>, )

Sets the album artist(s).

source

pub fn artist(&self) -> Option<Vec<String>>

The track artist(s).

source

pub fn set_artist( &mut self, artist: Option<impl IntoIterator<Item = impl Into<String>>>, )

Sets the track artist(s).

source

pub fn lyrics(&self) -> Option<&str>

The track lyrics.

source

pub fn set_lyrics(&mut self, lyrics: Option<impl Into<String>>)

Sets the track lyrics.

source

pub fn audio_bpm(&self) -> Option<i32>

The speed of the music, in beats per minute.

source

pub fn set_audio_bpm(&mut self, audio_bpm: Option<i32>)

Sets the speed of the music, in beats per minute.

source

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.

source

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.

source

pub fn comment(&self) -> Option<Vec<String>>

A (list of) freeform comment(s).

source

pub fn set_comment( &mut self, comment: Option<impl IntoIterator<Item = impl Into<String>>>, )

Sets a (list of) freeform comment(s).

source

pub fn composer(&self) -> Option<Vec<String>>

The composer(s) of the track.

source

pub fn set_composer( &mut self, composer: Option<impl IntoIterator<Item = impl Into<String>>>, )

Sets the composer(s) of the track.

source

pub fn content_created(&self) -> Option<DateTime>

When the track was created. Usually only the year component will be useful.

source

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.

source

pub fn disc_number(&self) -> Option<i32>

The disc number on the album that this track is from.

source

pub fn set_disc_number(&mut self, disc_number: Option<i32>)

Sets the disc number on the album that this track is from.

source

pub fn first_used(&self) -> Option<DateTime>

When the track was first played.

source

pub fn set_first_used(&mut self, first_used: Option<impl Into<DateTime>>)

Sets when the track was first played.

source

pub fn genre(&self) -> Option<Vec<String>>

The genre(s) of the track.

source

pub fn set_genre( &mut self, genre: Option<impl IntoIterator<Item = impl Into<String>>>, )

Sets the genre(s) of the track.

source

pub fn last_used(&self) -> Option<DateTime>

When the track was last played.

source

pub fn set_last_used(&mut self, last_used: Option<impl Into<DateTime>>)

Sets when the track was last played.

source

pub fn lyricist(&self) -> Option<Vec<String>>

The lyricist(s) of the track.

source

pub fn set_lyricist( &mut self, lyricist: Option<impl IntoIterator<Item = impl Into<String>>>, )

Sets the lyricist(s) of the track.

source

pub fn title(&self) -> Option<&str>

The track title.

source

pub fn set_title(&mut self, title: Option<impl Into<String>>)

Sets the track title.

source

pub fn track_number(&self) -> Option<i32>

The track number on the album disc.

source

pub fn set_track_number(&mut self, track_number: Option<i32>)

Sets the track number on the album disc.

source

pub fn url(&self) -> Option<Uri>

The location of the media file.

source

pub fn set_url(&mut self, url: Option<impl Into<Uri>>)

Sets the location of the media file.

source

pub fn use_count(&self) -> Option<i32>

The number of times the track has been played.

source

pub fn set_use_count(&mut self, use_count: Option<i32>)

Sets the number of times the track has been played.

source

pub fn user_rating(&self) -> Option<f64>

A user-specified rating. This should be in the range 0.0 to 1.0.

source

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§

source§

impl Clone for Metadata

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Metadata

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Metadata

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'a> From<Metadata> for Value<'a>

source§

fn from(metainfo: Metadata) -> Self

Converts to this type from the input type.
source§

impl PartialEq for Metadata

source§

fn eq(&self, other: &Metadata) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for Metadata

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Type for Metadata

source§

fn signature() -> Signature<'static>

Get the signature for the implementing type. Read more
source§

impl StructuralPartialEq for Metadata

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T> DynamicType for T
where T: Type + ?Sized,

§

fn dynamic_signature(&self) -> Signature<'_>

Get the signature for the implementing type. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more