#playerctl #player #track #allowing #control #command #metadata

playerctl-rust-wrapper

A Rust implementation of a playerctl wrapper

1 unstable release

new 0.1.0 Jan 11, 2025

#6 in #allowing

Download history 126/week @ 2025-01-06

126 downloads per month
Used in youtube-music-discord-rpc

MIT license

9KB
106 lines

Playerctl Rust Wrapper

A Rust implementation for a playerctl wrapper, allowing the control of the active player and current player track.

Example

use playerctl_wrapper::Playerctl;

fn main() {
    // Command the player to play
    Playerctl::play().unwrap();

    // Command the player to pause
    Playerctl::pause().unwrap();

    // Command the player to toggle between play/pause
    Playerctl::play_pause().unwrap();

    // Command the player to seek forward/backward OFFSET in seconds
    Playerctl::position(10.).unwrap();

    // Get metadata information for the current track
    let metadata = Playerctl::metadata().unwrap();

    println!(
        "Title: {}\nAlbum: {}\nArtist: {}\nURL: {}\nLength: {}",
        metadata.title, metadata.album, metadata.artist, metadata.url, metadata.length
    )
}

Author

Henrique BACELAR


lib.rs:

Playerctl Wrapper

A playerctl rust wrapper allowing the control of players and current playing track.

See the playerctl project for more information.

Dependencies

~265–730KB
~17K SLoC