async-mpd 0.1.0

Async Mpd client library
Documentation

Async-mpd

Async-std based Mpd client library

Example:

use async_mpd::MpdClient;

#[async_std::main]
async fn main() -> std::io::Result<()> {
    // Connect to server
    let mut mpd = MpdClient::new("localhost:6600").await?;

    // Get all tracks in the play queue and display them
    let queue = mpd.queue().await?;
    for track in queue {
        println!("{} - {}", track.artist, track.title);
    }

    // Play track nr 2 in the queue
    mpd.playid(2).await?;

    // Get and print the current server status
    println!("{:?}", mpd.status().await?);

    // Set the volume to 50%
    mpd.setvol(50).await?;

    Ok(())
}