Skip to main content

Mpris

Struct Mpris 

Source
pub struct Mpris {
    pub daemon: MusicPlayerClient,
    pub port: u16,
    pub state: RwLock<StateAudio>,
}

Fields§

§daemon: MusicPlayerClient§port: u16§state: RwLock<StateAudio>

Implementations§

Source§

impl Mpris

Source

pub fn new_with_daemon(daemon: MusicPlayerClient) -> Self

Create a new Mpris instance with a daemon already connected.

Source

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

Update the state from the daemon.

§Errors

Returns an error if the state cannot be retrieved from the daemon.

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 Debug for Mpris

Source§

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

Formats the value using the given formatter. Read more
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 UnsafeUnpin 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> 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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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