Skip to main content

TrackList

Struct TrackList 

Source
pub struct TrackList { /* private fields */ }
Expand description

Simplified access to the track list of an MPRIS media player.

Implementations§

Source§

impl TrackList

Source

pub async fn new(connection: &Connection, name: OwnedBusName) -> Result<Self>

Creates a new instance of the org.mpris.MediaPlayer2.TrackList interface.

Source

pub async fn add_track<S: ToString>( &self, uri: S, after: TrackId, set_as_current: bool, ) -> Result<()>

Adds a new track to this track list.

Source

pub async fn get_tracks_metadata<T: AsRef<[TrackId]>>( &self, tracks: T, ) -> Result<Vec<Metadata>>

Gets the metadata of the given tracks.

Source

pub async fn go_to(&self, track: TrackId) -> Result<()>

Goes to the specified track.

Source

pub async fn remove(&self, track: TrackId) -> Result<()>

Removes the specified track.

Source

pub async fn tracks(&self) -> Result<Vec<TrackId>>

Returns a list of all available TrackIds.

Source

pub async fn detailed_tracks(&self) -> Result<BTreeMap<TrackId, Metadata>>

Returns a list of all available TrackIds and their associated metadata, in order.

Methods from Deref<Target = TrackListProxy<'static>>§

Source

pub fn inner(&self) -> &Proxy<'p>

The reference to the underlying zbus::Proxy.

Source

pub async fn get_tracks_metadata( &self, track_ids: Vec<TrackId>, ) -> Result<Vec<Metadata>>

GetTracksMetadata method

Source

pub async fn add_track( &self, uri: &str, after_track: TrackId, set_as_current: bool, ) -> Result<()>

AddTrack method

Source

pub async fn remove_track(&self, track_id: TrackId) -> Result<()>

RemoveTrack method

Source

pub async fn go_to(&self, track_id: TrackId) -> Result<()>

GoTo method

Source

pub async fn receive_track_list_replaced( &self, ) -> Result<TrackListReplacedStream>

Create a stream that receives TrackListReplaced signals.

This a convenient wrapper around zbus::Proxy::receive_signal. TrackListReplaced signal

Indicates that the entire tracklist has been replaced.

It is left up to the implementation to decide when a change to the track list is invasive enough that this signal should be emitted instead of a series of TrackAdded and TrackRemoved signals.

/org/mpris/MediaPlayer2/TrackList/NoTrack indicates that there is no current track.

Source

pub async fn receive_track_list_replaced_with_args( &self, args: &[(u8, &str)], ) -> Result<TrackListReplacedStream>

Create a stream that receives TrackListReplaced signals.

This a convenient wrapper around zbus::Proxy::receive_signal_with_args. TrackListReplaced signal

Indicates that the entire tracklist has been replaced.

It is left up to the implementation to decide when a change to the track list is invasive enough that this signal should be emitted instead of a series of TrackAdded and TrackRemoved signals.

/org/mpris/MediaPlayer2/TrackList/NoTrack indicates that there is no current track.

Source

pub async fn receive_track_added(&self) -> Result<TrackAddedStream>

Create a stream that receives TrackAdded signals.

This a convenient wrapper around zbus::Proxy::receive_signal. TrackAdded signal

Indicates that a track has been added to the track list.

Source

pub async fn receive_track_added_with_args( &self, args: &[(u8, &str)], ) -> Result<TrackAddedStream>

Create a stream that receives TrackAdded signals.

This a convenient wrapper around zbus::Proxy::receive_signal_with_args. TrackAdded signal

Indicates that a track has been added to the track list.

Source

pub async fn receive_track_removed(&self) -> Result<TrackRemovedStream>

Create a stream that receives TrackRemoved signals.

This a convenient wrapper around zbus::Proxy::receive_signal. TrackRemoved signal

Indicates that a track has been removed from the track list.

Source

pub async fn receive_track_removed_with_args( &self, args: &[(u8, &str)], ) -> Result<TrackRemovedStream>

Create a stream that receives TrackRemoved signals.

This a convenient wrapper around zbus::Proxy::receive_signal_with_args. TrackRemoved signal

Indicates that a track has been removed from the track list.

Source

pub async fn receive_track_metadata_changed( &self, ) -> Result<TrackMetadataChangedStream>

Create a stream that receives TrackMetadataChanged signals.

This a convenient wrapper around zbus::Proxy::receive_signal. TrackMetadataChanged signal

Indicates that the metadata of a track in the tracklist has changed.

This may indicate that a track has been replaced, in which case the mpris:trackid metadata entry is different from the track argument.

Source

pub async fn receive_track_metadata_changed_with_args( &self, args: &[(u8, &str)], ) -> Result<TrackMetadataChangedStream>

Create a stream that receives TrackMetadataChanged signals.

This a convenient wrapper around zbus::Proxy::receive_signal_with_args. TrackMetadataChanged signal

Indicates that the metadata of a track in the tracklist has changed.

This may indicate that a track has been replaced, in which case the mpris:trackid metadata entry is different from the track argument.

Source

pub async fn tracks(&self) -> Result<Vec<TrackId>>

Tracks property

Source

pub fn cached_tracks( &self, ) -> Result<Option<<Result<Vec<TrackId>> as ResultAdapter>::Ok>, <Result<Vec<TrackId>> as ResultAdapter>::Err>

Tracks property Get the cached value of the Tracks property, or None if the property is not cached.

Source

pub async fn receive_tracks_changed( &self, ) -> PropertyStream<'p, <Result<Vec<TrackId>> as ResultAdapter>::Ok>

Tracks property Create a stream for the Tracks property changes. This is a convenient wrapper around zbus::Proxy::receive_property_changed.

Source

pub async fn can_edit_tracks(&self) -> Result<bool>

CanEditTracks property

Source

pub fn cached_can_edit_tracks( &self, ) -> Result<Option<<Result<bool> as ResultAdapter>::Ok>, <Result<bool> as ResultAdapter>::Err>

CanEditTracks property Get the cached value of the CanEditTracks property, or None if the property is not cached.

Source

pub async fn receive_can_edit_tracks_changed( &self, ) -> PropertyStream<'p, <Result<bool> as ResultAdapter>::Ok>

CanEditTracks property Create a stream for the CanEditTracks property changes. This is a convenient wrapper around zbus::Proxy::receive_property_changed.

Trait Implementations§

Source§

impl Clone for TrackList

Source§

fn clone(&self) -> TrackList

Returns a duplicate 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 TrackList

Source§

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

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

impl Deref for TrackList

Source§

type Target = TrackListProxy<'static>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl From<TrackListProxy<'static>> for TrackList

Source§

fn from(proxy: TrackListProxy<'static>) -> Self

Converts to this type from the input type.

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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 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.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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>,

Source§

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>,

Source§

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.
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