From 458e83a83d51a6e423cfef3c025906735f34f4ed Mon Sep 17 00:00:00 2001 From: Oliver Atkinson Date: Wed, 8 May 2024 14:55:51 -0600 Subject: [PATCH] fix filepath issues where yt video names can mess up path --- src/main.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index c836567..8fc37b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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, state: Data<&Arc>) -> 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()