From eb838afe24b3f33d8dff88d570574aeea8060f15 Mon Sep 17 00:00:00 2001 From: jakka Date: Thu, 19 Jun 2025 00:33:52 +0300 Subject: rewrote flac logic. added (non-working) batch reencoding test. added reencode status update on reencoding --- src/main.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index d660f0a..5d3835f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,14 +15,6 @@ fn build_cli() -> Command { .value_hint(ValueHint::DirPath) .value_parser(value_parser!(PathBuf)), ) - .arg( - Arg::new("index") - .short('i') - .long("index") - .help("Only index files") - .requires("path") - .action(ArgAction::SetTrue), - ) .arg( Arg::new("doit") .long("doit") @@ -97,13 +89,13 @@ fn main() -> Result<()> { }; let path = args.get_one::("path"); - if !args.get_flag("index") && !args.get_flag("clean") && !args.get_flag("doit") { - let count = files::count_reencode_files(&conn, path).await.unwrap(); + if path.is_none() && !args.get_flag("clean") && !args.get_flag("doit") { + let count = files::count_reencode_files(path, &conn).await.unwrap(); println!("Files to reencode:\t{count}"); - } - - if args.get_flag("index") { - files::index_files_recursively(path.unwrap(), &conn).await?; + } else if let Some(realpath) = path { + if !args.get_flag("doit") { + files::index_files_recursively(realpath, &conn).await?; + } } if args.get_flag("clean") { @@ -111,7 +103,7 @@ fn main() -> Result<()> { } if args.get_flag("doit") { - files::reencode_files(&conn, path).await?; + files::reencode_files(path, &conn).await?; } Ok::<(), anyhow::Error>(()) })?; -- cgit v1.3.1