#dbus #mpris #ipc #tokio

pris

A library for interfacing with players compatible with the MPRIS DBus specification

2 releases

0.1.1 Aug 8, 2022
0.1.0 Jun 12, 2021

#7 in #mpris

MIT license

18KB
284 lines

pris

A library for interfacing with MPRIS-compatible players, built in the tokio async runtime.


lib.rs:

This library provides a high-level interface to the MPRIS DBus specification.

It allows both controlling of a player, as well as listening for events and executing callbacks.

A basic player controller

use pris::{self, Player};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a connection to work with
    let conn = pris::get_connection();
    // Get a player under the name "vlc"
    let player = Player::try_new("vlc", &conn).await?;
    // Play/pause the player
    player.play_pause().await?;
}

This crate re-exports Message for use in typing non-closure callbacks.

Dependencies

~8–17MB
~236K SLoC