Crate pris

source · []
Expand description

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.

Re-exports

pub use dbus::message::Message;

Modules

Provides all of the methods needed to control and work with a Player.

Structs

A struct that simplifies the process of adding and removing listeners and callbacks to/from MPRIS DBus signals.

A struct used to control an MPRIS player.

Enums

Enum for indicating which type of MPRIS event to listen for.

Functions

Gets a Vec of Players from all active MPRIS players found on the DBus.

Establishes a connection to the DBus. Use this to create a connection to pass into Player.

Gets a value from a HashMap, and casts it to the type provided.