TianyiShi2001 / audiotags

Unified IO for different types of audio metadata
https://tianyishi2001.github.io/audiotags
MIT License
41 stars 29 forks source link

AudioTag::year() not always valid when it should be #9

Closed TurtleP closed 2 years ago

TurtleP commented 2 years ago

Hi,

I'm new to Rust and started working on a program which iterates through the id3 tags of my iTunes purchased music.

I checked iTunes for the Year tag, which is valid, but the AudioTag value is None. Here's a small example:

use std::path::Path;

let path = Path::new("03 How to Save a Life (New Version).m4a")
let tag = Tag::default().read_from_path(path);

let year = tag.year().unwrap_or(0);
println("Year {}", year)

-- Output
Year: 0

image

I don't have my code up on GitHub yet, although if you need anything further from me, please let me know.

pinkforest commented 2 years ago

We merged audiotags2 to audiotags with lots of updates so if you use the 0.4 version what result would you get ?

For tag try this:

let mut tag = Tag::new().read_from_path(MP3_FILE).expect("Could not open the file");