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

Create an empty Metadata.

source

pub fn builder() -> MetadataBuilder

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

source

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.

source

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.

source

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

Get the value of the given key, if it exists.

source

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.

source

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

The duration of the track in microseconds.

source

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.

source

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

The album name.

source

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

The album artist(s).

source

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

The track artist(s).

source

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

The track lyrics.

source

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

The speed of the music, in beats per minute.

source

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.

source

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

A (list of) freeform comment(s).

source

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

The composer(s) of the track.

source

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.

source

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

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

source

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

When the track was first played.

source

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

The genre(s) of the track.

source

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

When the track was last played.

source

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

The lyricist(s) of the track.

source

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

The track title.

source

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

The track number on the album disc.

source

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

The location of the media file.

source

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

The number of times the track has been played.

source

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.

Trait Implementations§

source§

impl Clone for Metadata

source§

fn clone(&self) -> Metadata

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<Metadata> for Metadata

source§

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

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

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

This method 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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T> DynamicType for Twhere 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.

source§

impl<T> Instrument for T

source§

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

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

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 Twhere 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 Twhere T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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 Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

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