Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
TurtleP opened this issue Dec 7, 2021 · 1 comment · Fixed by #21
Closed

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

TurtleP opened this issue Dec 7, 2021 · 1 comment · Fixed by #21

Comments

@TurtleP
Copy link

TurtleP commented Dec 7, 2021

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
Copy link
Collaborator

pinkforest commented Jul 31, 2022

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");

Serial-ATA added a commit to Serial-ATA/audiotags that referenced this issue Aug 1, 2022
Serial-ATA added a commit to Serial-ATA/audiotags that referenced this issue Aug 1, 2022
pinkforest pushed a commit that referenced this issue Aug 2, 2022
* Remove `unwrap` in `Tag::read_from_path`

closes: #7

* Fix `Id3v2Tag::{*year}` methods

closes: #9

* Fix unused `Result` in `Tag` doc example

* Reorder `FlagTag` and `Mp4Tag` impls to match `AudioTagEdit`

* Change `Tag::read_from_path` return type to `Result<Box<dyn AudioTag + Send + Sync>>`

closes: #8

* Fix doc test

* Fix typos

* Bump versions

* fmt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants