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> {
|
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> {
|
pub fn get_mpv_message() -> Result<FF2MpvMessage, FF2MpvError> {
|
||||||
|
|
|
@ -64,12 +64,15 @@ impl Command {
|
||||||
let config = Config::build();
|
let config = Config::build();
|
||||||
let ff2mpv_message = browser::get_mpv_message()?;
|
let ff2mpv_message = browser::get_mpv_message()?;
|
||||||
Command::launch_mpv(config.player_command, config.player_args, &ff2mpv_message.url)?;
|
Command::launch_mpv(config.player_command, config.player_args, &ff2mpv_message.url)?;
|
||||||
|
browser::send_reply()?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn launch_mpv(command: String, args: Vec<String>, url: &str) -> Result<(), io::Error> {
|
fn launch_mpv(command: String, args: Vec<String>, url: &str) -> Result<(), io::Error> {
|
||||||
process::Command::new(command)
|
process::Command::new(command)
|
||||||
|
.stdout(process::Stdio::null())
|
||||||
|
.stderr(process::Stdio::null())
|
||||||
.args(args)
|
.args(args)
|
||||||
.arg(url)
|
.arg(url)
|
||||||
.spawn()?;
|
.spawn()?;
|
||||||
|
|
Loading…
Reference in a new issue