Add a very simple example fetching properties

This commit is contained in:
Emmanuel Gil Peyrot 2019-06-18 23:02:39 +02:00
parent 8f105eb41f
commit bd18199bad
1 changed files with 15 additions and 0 deletions

15
examples/fetch_state.rs Normal file
View File

@ -0,0 +1,15 @@
use env_logger;
use mpvipc::{Mpv, Error as MpvError};
fn main() -> Result<(), MpvError> {
env_logger::init();
let mpv = Mpv::connect("/tmp/mpvsocket")?;
let meta = mpv.get_metadata()?;
println!("metadata: {:?}", meta);
let playlist = mpv.get_playlist()?;
println!("playlist: {:?}", playlist);
let playback_time: f64 = mpv.get_property("playback-time")?;
println!("playback-time: {}", playback_time);
Ok(())
}