fix filepath issues where yt video names can mess up path

This commit is contained in:
Oliver Atkinson 2024-05-08 14:55:51 -06:00
parent 29be35e4d1
commit 458e83a83d

View File

@ -17,13 +17,13 @@ use url::Url;
#[tokio::main]
async fn main() -> Result<(), std::io::Error> {
#[cfg(debug_assertions)]
// #[cfg(debug_assertions)]
let filter = EnvFilter::builder()
.parse("server=trace,poem=debug,tokio=warn")
.parse("server=debug,poem=debug,tokio=warn")
.expect("Could not create env filter.")
;
#[cfg(debug_assertions)]
// #[cfg(debug_assertions)]
tracing_subscriber::fmt::fmt()
.with_max_level(Level::TRACE)
.with_target(true)
@ -154,9 +154,11 @@ async fn download_url(Form(data): Form<Input>, state: Data<&Arc<AppData>>) -> po
match Command::new("yt-dlp")
.arg("--quiet") // shut up
.arg("--no-warnings") // shut up again
.arg("--windows-filenames") // windows compatible file name
.arg("--no-playlist") // if video or playlist, choose video
.args(["--print","after_move:filename,id"]) // output filename
.arg("--restrict-filenames") // take special chars out
.arg("--no-windows-filenames") // windows compatible file name
.args(["--output","id"]) // if video or playlist, choose video
.args(["--print","after_move:filename,id"]) // output filename
.args(["-f", OutputFormat::Video.to_format()]) // format selector
.arg(data.url.clone())
.output()