Skip to main content

Crate doobs_mpris

Crate doobs_mpris 

Source
Expand description

This crate provides zbus bindings for the MPRIS D-Bus Interface Specification.

It can be used to connect to and discover existing media players that implement the MPRIS specification, as well as adding MPRIS-support to your own media player.

The main goal is to make working with MPRIS as simple as possible by providing custom types and default implementations:

  • LoopStatus, PlaybackStatus and PlaylistOrdering are exposed as enums instead of strings
  • durations (playback position and seeked amount) are exposed as SignedDurations instead of microseconds, so you can easily convert them to and from your desired type
  • instead of directly implementing the zbus interfaces there is a Provider trait for each D-Bus interface
    • these contain default implementations for all D-Bus methods and properties that aren’t necessary for a read-only media player to make it easy to get started quickly

§Connecting to an existing player

let conn = zbus::Connection::session().await?;
let proxy = PlayerProxy::new(&conn, "org.mpris.MediaPlayer2.some_mpris_player").await?;
proxy.play_pause().await?;

There are also examples for automatically discovering players.

§Creating a new player

See the player example.

Modules§

binding
Bindings for all the MPRIS 2.2 interfaces.
types
Types that can be used as zbus values.

Structs§

Enumerator
Helper to list MPRIS players on D-Bus bus, and watch for addition/removal.
MediaPlayer
Simplified access MPRIS media players.
Player
Simplified access to the controls of an MPRIS media player.
Playlists
Simplified access to the playlists of an MPRIS media player.
TrackList
Simplified access to the track list of an MPRIS media player.

Enums§

EnumeratorEvent
Returned from Enumerator::receive_changes when an MPRIS player was added or removed.
Error
The error type for doobs_mpris.

Type Aliases§

Result
Alias for Result with the error type doobs_mpris::Error.