Crate empris[][src]

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 empris::{self, Player};
 
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create a connection to work with
    let conn = empris::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

methods

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

Structs

EventManager

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

Player

A struct used to control an MPRIS player.

Enums

EventType

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

Functions

get_all_players

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

get_connection

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

prop_cast

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