Compare commits

...
4 Commits
Author SHA1 Message Date
sheepish e37f0fe12a sort files by name 2024-06-17 00:59:39 +02:00
Spider da37c5555c Version bump 2023-11-08 15:26:27 +11:00
Spider 709cdf7972 Update path handling for ~ . 2023-11-08 15:22:50 +11:00
Spider 0359763491 Add error print 2023-11-08 15:22:25 +11:00
3 changed files with 14 additions and 5 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
[package]
name = "audioinfo"
version = "0.0.1"
version = "0.0.2"
edition = "2021"
[dependencies]
+12 -4
View File
@@ -46,12 +46,20 @@ fn main() {
)
.expect("Failed to set global default tracing subscriber");
}
let directory = matches
let path = matches
.get_one::<PathBuf>("input")
.expect("required")
.clone();
let audio_info_string = AudioInfo::generate_audio_info_from_path(directory);
let full_path = match fs::canonicalize(path) {
Ok(full_path) => full_path,
Err(e) => {
eprintln!("Error: {}", e);
std::process::exit(1);
}
};
let audio_info_string = AudioInfo::generate_audio_info_from_path(full_path);
if print {
print!("{:}", audio_info_string);
@@ -71,9 +79,9 @@ fn save_file(path: String, audio_info_string: String) {
let audioinfo_file_path = Path::new(&path);
if let Ok(mut file) = fs::File::create(audioinfo_file_path) {
if let Err(e) = file.write_all(audio_info_string.as_bytes()) {
println!("Error writing to audioinfo file: {}", e);
eprintln!("Error writing to audioinfo file: {}", e);
}
} else {
println!("Error creating audioinfo file");
eprintln!("Error creating audioinfo file");
}
}
+1
View File
@@ -133,6 +133,7 @@ impl AudioInfo {
fn walk_dir(dir: &PathBuf) -> Vec<AudioFile> {
let mut songs: Vec<AudioFile> = Vec::new();
for entry in WalkDir::new(dir)
.sort_by_file_name()
.into_iter()
.filter_map(|e| e.ok())
.filter(|f| {