|
|
@ -99,7 +99,7 @@ pub fn open_external(url: &str) -> Result<()> {
|
|
|
|
#[cfg(feature = "media")]
|
|
|
|
#[cfg(feature = "media")]
|
|
|
|
/// Opens a media file with `mpv`.
|
|
|
|
/// Opens a media file with `mpv`.
|
|
|
|
pub fn open_media(url: &str) -> Result<()> {
|
|
|
|
pub fn open_media(url: &str) -> Result<()> {
|
|
|
|
use crate::terminal;
|
|
|
|
use {crate::terminal, std::io};
|
|
|
|
|
|
|
|
|
|
|
|
// mpv only supports /9/
|
|
|
|
// mpv only supports /9/
|
|
|
|
let url = url.replace("/;/", "/9/").replace("/s/", "/9/");
|
|
|
|
let url = url.replace("/;/", "/9/").replace("/s/", "/9/");
|
|
|
@ -119,6 +119,11 @@ pub fn open_media(url: &str) -> Result<()> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// clear screen first
|
|
|
|
|
|
|
|
let mut stdout = io::stdout();
|
|
|
|
|
|
|
|
write!(stdout, "{}{}", terminal::ClearAll, terminal::Goto(1, 1))?;
|
|
|
|
|
|
|
|
stdout.flush()?;
|
|
|
|
|
|
|
|
|
|
|
|
terminal::disable_raw_mode()?;
|
|
|
|
terminal::disable_raw_mode()?;
|
|
|
|
let mut cmd = process::Command::new("mpv")
|
|
|
|
let mut cmd = process::Command::new("mpv")
|
|
|
|
.arg(url)
|
|
|
|
.arg(url)
|
|
|
|