Included observation ID in PropertyChange event

This commit is contained in:
Jonas Frei 2019-06-20 05:58:31 +02:00
parent d5ecc48b1d
commit 5b28c95a0a
4 changed files with 4 additions and 7 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "mpvipc"
version = "1.1.6"
version = "1.1.7"
authors = ["Jonas Frei <freijon@pm.me>"]
description = "A small library which provides bindings to control existing mpv instances through sockets."
license = "GPL-3.0"

View File

@ -26,7 +26,7 @@ fn main() -> Result<(), Error> {
loop {
let event = mpv.event_listen()?;
match event {
Event::PropertyChange(property) => match property {
Event::PropertyChange(_, property) => match property {
Property::Path(Some(value)) => println!("\nPlaying: {}", value),
Property::Path(None) => (),
Property::Pause(value) => pause = value,
@ -52,7 +52,6 @@ fn main() -> Result<(), Error> {
Property::Metadata(None) => (),
Property::Unknown {
name: _,
id: _,
data: _,
} => (),
},

View File

@ -308,12 +308,11 @@ fn try_convert_property(name: &str, id: isize, data: MpvDataType) -> Event {
warn!("Property {} not implemented", name);
Property::Unknown {
name: name.to_string(),
id,
data,
}
}
};
Event::PropertyChange(property)
Event::PropertyChange(id, property)
}
pub fn listen(instance: &mut Mpv) -> Result<Event, Error> {

View File

@ -36,7 +36,7 @@ pub enum Event {
MetadataUpdate,
Seek,
PlaybackRestart,
PropertyChange(Property),
PropertyChange(isize, Property),
ChapterChange,
Unimplemented,
}
@ -50,7 +50,6 @@ pub enum Property {
Metadata(Option<HashMap<String, MpvDataType>>),
Unknown {
name: String,
id: isize,
data: MpvDataType,
},
}