mpvipc-async/examples/fetch_state.rs

17 lines
491 B
Rust
Raw Normal View History

use env_logger;
2019-06-19 00:51:11 +02:00
use mpvipc::{Error as MpvError, Mpv};
#[tokio::main]
async fn main() -> Result<(), MpvError> {
env_logger::init();
let mpv = Mpv::connect("/tmp/mpv.sock").await?;
let meta = mpv.get_metadata().await?;
println!("metadata: {:?}", meta);
let playlist = mpv.get_playlist().await?;
println!("playlist: {:?}", playlist);
let playback_time: f64 = mpv.get_property("playback-time").await?;
println!("playback-time: {}", playback_time);
Ok(())
}