[][src]Struct mpris::Metadata

pub struct Metadata { /* fields omitted */ }

A structured representation of the Player metadata.

Methods

impl Metadata[src]

pub fn new<S>(track_id: S) -> Self where
    S: Into<String>, 
[src]

Create a new Metadata struct with a given track_id.

This is mostly useful for test fixtures and other places where you want to work with mock data.

pub fn get(&self, key: &str) -> Option<&Value>[src]

Get a value from the metadata by key name.

Examples

if let Some(MetadataValue::String(name)) = metadata.get("xesam:composer") {
    println!("Composed by: {}", name);
}

pub fn track_id(&self) -> Option<TrackID>[src]

The track ID.

If the TrackID could not be parsed as a proper TrackID, None will be returned.

Based on mpris:trackid

A unique identity for this track within the context of an MPRIS object.

pub fn album_artists(&self) -> Option<Vec<&str>>[src]

A list of artists of the album the track appears on.

Based on xesam:albumArtist

The album artist(s).

pub fn album_name(&self) -> Option<&str>[src]

The name of the album the track appears on.

Based on xesam:album

The album name.

pub fn art_url(&self) -> Option<&str>[src]

An URL to album art of the current track.

Based on mpris:artUrl

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.

pub fn artists(&self) -> Option<Vec<&str>>[src]

A list of artists of the track.

Based on xesam:artist

The track artist(s).

pub fn auto_rating(&self) -> Option<f64>[src]

Based on xesam:autoRating

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.

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

Based on xesam:discNumber

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

pub fn length_in_microseconds(&self) -> Option<u64>[src]

The duration of the track, in microseconds

Based on mpris:length

The duration of the track in microseconds.

pub fn length(&self) -> Option<Duration>[src]

The duration of the track, as a Duration

Based on mpris:length.

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

The name of the track.

Based on xesam:title

The track title.

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

The track number on the disc of the album the track appears on.

Based on xesam:trackNumber

The track number on the album disc.

pub fn url(&self) -> Option<&str>[src]

A URL to the media being played.

Based on xesam:url

The location of the media file.

Trait Implementations

impl Clone for Metadata[src]

impl Debug for Metadata[src]

impl Default for Metadata[src]

impl From<HashMap<String, Value, RandomState>> for Metadata[src]

impl From<Metadata> for HashMap<String, Value>[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.