Using _isize_ instead of _usize_ for observation as per mpv documentation
This commit is contained in:
parent
f499d730e8
commit
442f121b2e
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "mpvipc"
|
||||
version = "1.2.0"
|
||||
version = "1.2.1"
|
||||
authors = ["Jonas Frei <freijon@pm.me>"]
|
||||
description = "A small library which provides bindings to control existing mpv instances through sockets."
|
||||
license = "GPL-3.0"
|
||||
|
|
|
@ -257,7 +257,7 @@ pub fn run_mpv_command(instance: &Mpv, command: &str, args: &[&str]) -> Result<(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn observe_mpv_property(instance: &Mpv, id: &usize, property: &str) -> Result<(), Error> {
|
||||
pub fn observe_mpv_property(instance: &Mpv, id: &isize, property: &str) -> Result<(), Error> {
|
||||
let ipc_string = format!(
|
||||
"{{ \"command\": [\"observe_property\", {}, \"{}\"] }}\n",
|
||||
id, property
|
||||
|
@ -278,7 +278,7 @@ pub fn observe_mpv_property(instance: &Mpv, id: &usize, property: &str) -> Resul
|
|||
}
|
||||
}
|
||||
|
||||
pub fn unobserve_mpv_property(instance: &Mpv, id: &usize) -> Result<(), Error> {
|
||||
pub fn unobserve_mpv_property(instance: &Mpv, id: &isize) -> Result<(), Error> {
|
||||
let ipc_string = format!("{{ \"command\": [\"unobserve_property\", {}] }}\n", id);
|
||||
match serde_json::from_str::<Value>(&send_command_sync(instance, &ipc_string)) {
|
||||
Ok(feedback) => {
|
||||
|
|
|
@ -53,7 +53,7 @@ pub enum MpvCommand {
|
|||
to: usize,
|
||||
},
|
||||
Observe {
|
||||
id: usize,
|
||||
id: isize,
|
||||
property: String
|
||||
},
|
||||
PlaylistNext,
|
||||
|
@ -66,7 +66,7 @@ pub enum MpvCommand {
|
|||
option: SeekOptions,
|
||||
},
|
||||
Stop,
|
||||
Unobserve(usize),
|
||||
Unobserve(isize),
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
@ -410,14 +410,14 @@ impl Mpv {
|
|||
self.run_command(MpvCommand::PlaylistNext)
|
||||
}
|
||||
|
||||
pub fn observe_property(&self, id: usize, property: &str) -> Result<(), Error> {
|
||||
pub fn observe_property(&self, id: isize, property: &str) -> Result<(), Error> {
|
||||
self.run_command(MpvCommand::Observe {
|
||||
id: id,
|
||||
property: property.to_string(),
|
||||
})
|
||||
}
|
||||
|
||||
pub fn unobserve_property(&self, id: usize) -> Result<(), Error> {
|
||||
pub fn unobserve_property(&self, id: isize) -> Result<(), Error> {
|
||||
self.run_command(MpvCommand::Unobserve(id))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue