audio tagging utilities

format

Stella 25a5ab3d 246eafff

Changed files
+9 -13
src
+9 -13
src/main.rs
··· 12 12 recursive: bool, 13 13 14 14 /// Output format: one of json, print, debug 15 - /// Output format: one of json, pjson, print, debug 16 - #[arg(short = 'o', long, default_value_t = Output::Json)] 17 - output: Output, 15 + #[arg(short = 'o', long, default_value_t = Output::Json)] 16 + output: Output, 18 17 19 - /// Pretty-print output. With `--output json` this prints pretty JSON. With `--output debug` this prints human-friendly text. 20 - #[arg(long)] 21 - pretty: bool, 18 + /// Pretty-print output. With `--output json` this prints pretty JSON. With `--output debug` this prints human-friendly text. 19 + #[arg(long)] 20 + pretty: bool, 22 21 23 - /// Only output files that fail one or more validations (imperfect data) 24 - #[arg(long)] 25 - only_imperfect: bool, 22 + /// Only output files that fail one or more validations (imperfect data) 23 + #[arg(long)] 24 + only_imperfect: bool, 26 25 /// Directory to scan 27 26 directory: String, 28 27 } ··· 135 134 } 136 135 } 137 136 138 - type ResultType = Result<Vec<AudioFileEntry>, Box<dyn std::error::Error>>; 139 - 140 137 /// A validation result: None == ok, Some(reason) == failed with reason 141 138 type ValidationResult = Option<String>; 142 139 143 - /// Validator trait for AudioFileEntry 144 140 trait Validator { 145 141 fn validate(&self, entry: &AudioFileEntry) -> ValidationResult; 146 142 } ··· 224 220 } 225 221 } 226 222 227 - fn read_folder<P: AsRef<Path>>(path: P, recursive: bool) -> ResultType { 223 + fn read_folder<P: AsRef<Path>>(path: P, recursive: bool) -> Result<Vec<AudioFileEntry>, Box<dyn std::error::Error>> { 228 224 let dir_path = path.as_ref(); 229 225 if !dir_path.is_dir() { 230 226 return Err(format!("Path is not a directory: {}", dir_path.display()).into());