feat: basic tag reading
This commit is contained in:
+27
-2
@@ -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(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user