doobs-mpris 0.2.0

zbus-based bindings for MPRIS2 (Media Player Remote Interfacing Specification) on Linux
Documentation

doobs-mpris

Crates.io Version API Documentation License CI

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.

Acknowledgements

This started as a fork of the MPRIS bindings from Pop!_OS.

License

Licensed under the Mozilla Public License Version 2.0.