Struct Mpris

Source
pub struct Mpris {
    pub port: u16,
    pub state: RwLock<StateAudio>,
    /* private fields */
}

Fields§

§port: u16§state: RwLock<StateAudio>

Implementations§

Source§

impl Mpris

Source

pub fn new(port: u16) -> Self

Create a new Mpris instance pending a connection to a daemon.

Source

pub async fn daemon(&self) -> RwLockReadGuard<'_, Option<MusicPlayerClient>>

Give access to the inner Daemon client (checks if the daemon is connected first).

Source

pub fn new_with_daemon(daemon: MusicPlayerClient) -> Self

Create a new Mpris instance with a daemon already connected.

Source

pub async fn connect(&self) -> Result<()>

Connect to the daemon.

§Errors

Returns an error if the daemon cannot be connected.

Source

pub async fn connect_with_retry(&self) -> Result<()>

Connect to the daemon if not already connected.

§Errors

Returns an error if the daemon cannot be connected after 5 retries.

Source

pub async fn start_server( self, bus_name_suffix: &str, ) -> Result<Server<Self>, ZbusError>

Start the Mpris server.

Consumes self, but you can get back a reference to it by calling imp() on the returned Server.

§Errors

Returns an error if the server cannot be started.

Trait Implementations§

Source§

impl PlayerInterface for Mpris

Source§

async fn next(&self) -> Result<()>

Skips to the next track in the tracklist. Read more
Source§

async fn previous(&self) -> Result<()>

Skips to the previous track in the tracklist. Read more
Source§

async fn pause(&self) -> Result<()>

Pauses playback. Read more
Source§

async fn play_pause(&self) -> Result<()>

Pauses playback. Read more
Source§

async fn stop(&self) -> Result<()>

Stops playback. Read more
Source§

async fn play(&self) -> Result<()>

Starts or resumes playback. Read more
Source§

async fn open_uri(&self, uri: String) -> Result<()>

Opens the uri given as an argument Read more
Source§

async fn playback_status(&self) -> Result<PlaybackStatus>

The current playback status. Read more
Source§

async fn loop_status(&self) -> Result<LoopStatus>

The current loop / repeat status Read more
Source§

async fn set_loop_status( &self, loop_status: LoopStatus, ) -> Result<(), ZbusError>

Sets the current loop / repeat status Read more
Source§

async fn rate(&self) -> Result<PlaybackRate>

The current playback rate. Read more
Source§

async fn set_rate(&self, _: PlaybackRate) -> Result<(), ZbusError>

Sets the current playback rate. Read more
Source§

async fn shuffle(&self) -> Result<bool>

Whether playback is shuffled. Read more
Source§

async fn set_shuffle(&self, shuffle: bool) -> Result<(), ZbusError>

Sets whether playback is shuffled. Read more
Source§

async fn metadata(&self) -> Result<Metadata>

The metadata of the current element. Read more
Source§

async fn volume(&self) -> Result<Volume>

The volume level. Read more
Source§

async fn set_volume(&self, volume: Volume) -> Result<(), ZbusError>

Sets the volume level. Read more
Source§

async fn position(&self) -> Result<Time>

The current track position, between 0 and the mpris:length metadata entry. Read more
Source§

async fn seek(&self, offset: Time) -> Result<()>

Seeks forward in the current track by the specified offset in time. Read more
Source§

async fn set_position(&self, track_id: TrackId, position: Time) -> Result<()>

Sets the current track position. Read more
Source§

async fn minimum_rate(&self) -> Result<PlaybackRate>

The minimum value which the Rate property can take. Clients should not attempt to set the Rate property below this value. Read more
Source§

async fn maximum_rate(&self) -> Result<PlaybackRate>

The maximum value which the Rate property can take. Clients should not attempt to set the Rate property above this value. Read more
Source§

async fn can_go_next(&self) -> Result<bool>

Whether the client can call the Next method on this interface and expect the current track to change. Read more
Source§

async fn can_go_previous(&self) -> Result<bool>

Whether the client can call the Previous method on this interface and expect the current track to change. Read more
Source§

async fn can_play(&self) -> Result<bool>

Whether playback can be started using Play or PlayPause. Read more
Source§

async fn can_pause(&self) -> Result<bool>

Whether playback can be paused using Pause or PlayPause. Read more
Source§

async fn can_seek(&self) -> Result<bool>

Whether the client can control the playback position using Seek and SetPosition. This may be different for different tracks. Read more
Source§

async fn can_control(&self) -> Result<bool>

Whether the media player may be controlled over this interface. Read more
Source§

impl RootInterface for Mpris

Source§

async fn raise(&self) -> Result<()>

Brings the media player’s user interface to the front using any appropriate mechanism available. Read more
Source§

async fn quit(&self) -> Result<()>

Causes the media player to stop running. Read more
Source§

async fn can_quit(&self) -> Result<bool>

Whether the player may be asked to quit. Read more
Source§

async fn fullscreen(&self) -> Result<bool>

Whether the media player is occupying the fullscreen. Read more
Source§

async fn set_fullscreen(&self, _: bool) -> Result<(), ZbusError>

Sets whether the media player is occupying the fullscreen. Read more
Source§

async fn can_set_fullscreen(&self) -> Result<bool>

Whether the player may be asked to enter or leave fullscreen. Read more
Source§

async fn can_raise(&self) -> Result<bool>

Whether the media player may be asked to be raised. Read more
Source§

async fn has_track_list(&self) -> Result<bool>

Indicates whether the /org/mpris/MediaPlayer2 object implements the TrackList interface. Read more
Source§

async fn identity(&self) -> Result<String>

A friendly name to identify the media player to users (eg: “VLC media player”). Read more
Source§

async fn desktop_entry(&self) -> Result<String>

The basename of an installed .desktop file which complies with the Desktop entry specification, with the “.desktop” extension stripped. Read more
Source§

async fn supported_uri_schemes(&self) -> Result<Vec<String>>

The URI schemes supported by the media player. Read more
Source§

async fn supported_mime_types(&self) -> Result<Vec<String>>

The mime-types supported by the media player. Read more

Auto Trait Implementations§

§

impl !Freeze for Mpris

§

impl !RefUnwindSafe for Mpris

§

impl Send for Mpris

§

impl Sync for Mpris

§

impl Unpin for Mpris

§

impl UnwindSafe for Mpris

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

unsafe fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

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