diff --git a/src/stremio_app/stremio_player/communication.rs b/src/stremio_app/stremio_player/communication.rs index 02204d7..ab49f2f 100644 --- a/src/stremio_app/stremio_player/communication.rs +++ b/src/stremio_app/stremio_player/communication.rs @@ -191,7 +191,7 @@ stringable!(FpProp); pub enum StrProp { FfmpegVersion, Hwdec, - InputDefaltBindings, + InputDefaultBindings, InputVoKeyboard, Metadata, MpvVersion, diff --git a/src/stremio_app/stremio_player/player.rs b/src/stremio_app/stremio_player/player.rs index f8b1819..5a47419 100644 --- a/src/stremio_app/stremio_player/player.rs +++ b/src/stremio_app/stremio_player/player.rs @@ -158,40 +158,12 @@ fn create_message_thread( }; let send_command = |cmd: CmdVal| { - let a1; - let a2; - let a3; - let a4; - let (name, args) = match cmd { - CmdVal::Quintuple(name, arg1, arg2, arg3, arg4) => { - a1 = format!(r#""{arg1}""#); - a2 = format!(r#""{arg2}""#); - a3 = format!(r#""{arg3}""#); - a4 = format!(r#""{arg4}""#); - ( - name, - vec![a1.as_ref(), a2.as_ref(), a3.as_ref(), a4.as_ref()], - ) + let parts: Vec = cmd.into(); + if let Some((name, args)) = parts.split_first() { + let args = args.iter().map(String::as_str).collect::>(); + if let Err(error) = mpv.command(name, &args) { + eprintln!("failed to execute MPV command: '{error:#}'") } - CmdVal::Quadruple(name, arg1, arg2, arg3) => { - a1 = format!(r#""{arg1}""#); - a2 = format!(r#""{arg2}""#); - a3 = format!(r#""{arg3}""#); - (name, vec![a1.as_ref(), a2.as_ref(), a3.as_ref()]) - } - CmdVal::Tripple(name, arg1, arg2) => { - a1 = format!(r#""{arg1}""#); - a2 = format!(r#""{arg2}""#); - (name, vec![a1.as_ref(), a2.as_ref()]) - } - CmdVal::Double(name, arg1) => { - a1 = format!(r#""{arg1}""#); - (name, vec![a1.as_ref()]) - } - CmdVal::Single((name,)) => (name, vec![]), - }; - if let Err(error) = mpv.command(&name.to_string(), &args) { - eprintln!("failed to execute MPV command: '{error:#}'") } };