audio tagging utilities

format

Stella 25a5ab3d 246eafff

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