Updated examples to use adapted observe command

This commit is contained in:
Jonas Frei 2022-07-10 15:32:04 +02:00
parent b21f0c804b
commit 1c9e32671e
2 changed files with 7 additions and 7 deletions

View File

@ -4,7 +4,7 @@ use mpvipc::{Error as MpvError, Mpv};
fn main() -> Result<(), MpvError> {
env_logger::init();
let mpv = Mpv::connect("/tmp/mpvsocket")?;
let mpv = Mpv::connect("/tmp/mpv.sock")?;
let meta = mpv.get_metadata()?;
println!("metadata: {:?}", meta);
let playlist = mpv.get_playlist()?;

View File

@ -14,15 +14,15 @@ fn seconds_to_hms(total: f64) -> String {
fn main() -> Result<(), Error> {
env_logger::init();
let mut mpv = Mpv::connect("/tmp/mpvsocket")?;
let mut mpv = Mpv::connect("/tmp/mpv.sock")?;
let mut pause = false;
let mut playback_time = std::f64::NAN;
let mut duration = std::f64::NAN;
mpv.observe_property(&1, "path")?;
mpv.observe_property(&2, "pause")?;
mpv.observe_property(&3, "playback-time")?;
mpv.observe_property(&4, "duration")?;
mpv.observe_property(&5, "metadata")?;
mpv.observe_property(1, "path")?;
mpv.observe_property(2, "pause")?;
mpv.observe_property(3, "playback-time")?;
mpv.observe_property(4, "duration")?;
mpv.observe_property(5, "metadata")?;
loop {
let event = mpv.event_listen()?;
match event {