Send reply to browser and suppress output from mpv #2
2 changed files with 5 additions and 1 deletions
|
@ -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> {
|
||||
|
|
|
@ -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()?;
|
||||
|
|
Loading…
Reference in a new issue