|
|
@ -14,10 +14,7 @@ struct Video { |
|
|
|
|
|
|
|
|
|
|
|
#[post("/new", data = "<video>")] |
|
|
|
#[post("/new", data = "<video>")] |
|
|
|
fn new(video: Form<Video>) -> Redirect { |
|
|
|
fn new(video: Form<Video>) -> Redirect { |
|
|
|
// let mpv_script_path = "/home/hans/mpv_send.sh";
|
|
|
|
|
|
|
|
if video.link.starts_with("https://"){ |
|
|
|
if video.link.starts_with("https://"){ |
|
|
|
// Command::new(mpv_script_path).arg(&video.link).output().expect("Failed to execute command");
|
|
|
|
|
|
|
|
// Command::new(mpv_script_path).arg(&video.link).output().expect("Failed to execute command");
|
|
|
|
|
|
|
|
Command::new("/bin/env").args(&["bash", "-c", &format!("mpv {link}", link=&video.link).to_string()]).output().expect("Failed to execute command"); |
|
|
|
Command::new("/bin/env").args(&["bash", "-c", &format!("mpv {link}", link=&video.link).to_string()]).output().expect("Failed to execute command"); |
|
|
|
} |
|
|
|
} |
|
|
|
Redirect::to("/") |
|
|
|
Redirect::to("/") |
|
|
|