mpvipc-async/examples/fetch_state.rs

20 lines
488 B
Rust
Raw Normal View History

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