mirror of
https://github.com/OPSnet/audioinfo.git
synced 2026-11-08 08:12:18 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e37f0fe12a | ||
|
|
da37c5555c | ||
|
|
709cdf7972 | ||
|
|
0359763491 |
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "audioinfo"
|
||||
version = "0.0.1"
|
||||
version = "0.0.2"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
|
||||
+12
-4
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -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| {
|
||||
|
||||
Reference in new issue
Block a user