reuse property_parser for highlevel api, add more highlevel functions

This commit is contained in:
2024-05-04 23:01:17 +02:00
parent 66d54a58aa
commit eb81d7c463
7 changed files with 403 additions and 249 deletions

View File

@@ -1,5 +1,5 @@
use futures::{stream::StreamExt, Stream};
use mpvipc::{parse_event_property, Event, Mpv, MpvError, MpvExt};
use mpvipc::{parse_property, Event, Mpv, MpvError, MpvExt};
use thiserror::Error;
use tokio::time::sleep;
use tokio::time::{timeout, Duration};
@@ -38,8 +38,8 @@ where
match event {
Some(Ok(event)) => {
match event {
Event::PropertyChange { id: MPV_CHANNEL_ID, .. } => {
let property = parse_event_property(event).unwrap().1;
Event::PropertyChange { id: MPV_CHANNEL_ID, name, data } => {
let property = parse_property(&name, data).unwrap();
if !on_property(property.clone()) {
return Err(PropertyCheckingThreadError::UnexpectedPropertyError(property))
}