Included observation ID in PropertyChange event
This commit is contained in:
parent
d5ecc48b1d
commit
b8590c2ae3
|
@ -26,7 +26,7 @@ fn main() -> Result<(), Error> {
|
||||||
loop {
|
loop {
|
||||||
let event = mpv.event_listen()?;
|
let event = mpv.event_listen()?;
|
||||||
match event {
|
match event {
|
||||||
Event::PropertyChange(property) => match property {
|
Event::PropertyChange(_, property) => match property {
|
||||||
Property::Path(Some(value)) => println!("\nPlaying: {}[K", value),
|
Property::Path(Some(value)) => println!("\nPlaying: {}[K", value),
|
||||||
Property::Path(None) => (),
|
Property::Path(None) => (),
|
||||||
Property::Pause(value) => pause = value,
|
Property::Pause(value) => pause = value,
|
||||||
|
@ -52,7 +52,6 @@ fn main() -> Result<(), Error> {
|
||||||
Property::Metadata(None) => (),
|
Property::Metadata(None) => (),
|
||||||
Property::Unknown {
|
Property::Unknown {
|
||||||
name: _,
|
name: _,
|
||||||
id: _,
|
|
||||||
data: _,
|
data: _,
|
||||||
} => (),
|
} => (),
|
||||||
},
|
},
|
||||||
|
|
|
@ -308,12 +308,11 @@ fn try_convert_property(name: &str, id: isize, data: MpvDataType) -> Event {
|
||||||
warn!("Property {} not implemented", name);
|
warn!("Property {} not implemented", name);
|
||||||
Property::Unknown {
|
Property::Unknown {
|
||||||
name: name.to_string(),
|
name: name.to_string(),
|
||||||
id,
|
|
||||||
data,
|
data,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Event::PropertyChange(property)
|
Event::PropertyChange(id, property)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn listen(instance: &mut Mpv) -> Result<Event, Error> {
|
pub fn listen(instance: &mut Mpv) -> Result<Event, Error> {
|
||||||
|
|
|
@ -36,7 +36,7 @@ pub enum Event {
|
||||||
MetadataUpdate,
|
MetadataUpdate,
|
||||||
Seek,
|
Seek,
|
||||||
PlaybackRestart,
|
PlaybackRestart,
|
||||||
PropertyChange(Property),
|
PropertyChange(isize, Property),
|
||||||
ChapterChange,
|
ChapterChange,
|
||||||
Unimplemented,
|
Unimplemented,
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,6 @@ pub enum Property {
|
||||||
Metadata(Option<HashMap<String, MpvDataType>>),
|
Metadata(Option<HashMap<String, MpvDataType>>),
|
||||||
Unknown {
|
Unknown {
|
||||||
name: String,
|
name: String,
|
||||||
id: isize,
|
|
||||||
data: MpvDataType,
|
data: MpvDataType,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue