Send reply to browser and suppress output from mpv #2

Merged
Gobbel2000 merged 2 commits from improvements into main 2023-04-10 01:59:50 +02:00
2 changed files with 5 additions and 1 deletions
Showing only changes of commit 3c9db73c54 - Show all commits

View file

@ -11,7 +11,8 @@ pub struct FF2MpvMessage {
}
pub fn send_reply() -> Result<(), io::Error> {
send_message("ok")
// "ok" formatted as a JSON string
send_message("\"ok\"")
}
pub fn get_mpv_message() -> Result<FF2MpvMessage, FF2MpvError> {

View file

@ -64,12 +64,15 @@ impl Command {
let config = Config::build();
let ff2mpv_message = browser::get_mpv_message()?;
Command::launch_mpv(config.player_command, config.player_args, &ff2mpv_message.url)?;
browser::send_reply()?;
Ok(())
}
fn launch_mpv(command: String, args: Vec<String>, url: &str) -> Result<(), io::Error> {
process::Command::new(command)
.stdout(process::Stdio::null())
.stderr(process::Stdio::null())
.args(args)
.arg(url)
.spawn()?;