feat: basic tag reading

This commit is contained in:
2026-08-19 16:18:16 +02:00
parent f2c8fa0c24
commit 63fb8890ee
3 changed files with 29 additions and 84 deletions
+27 -2
View File
@@ -1,3 +1,28 @@
fn main() {
println!("Hello, world!");
use lofty::file::TaggedFileExt;
use lofty::probe::Probe;
use std::env;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
return Err("Not a file. Usage: music-sort <file_path>".into());
}
let file_path = &args[1];
let tagged_file = Probe::open(file_path)
.expect("ERROR: Bad path provided!")
.read()
.expect("ERROR: Failed to read file!");
let id3v2 = tagged_file.primary_tag();
if let Some(tag) = id3v2 {
for item in tag.items() {
println!("{:?}", item);
}
}
Ok(())
}