Skip to content
New issue

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

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

Already on GitHub? # to your account

ID3v2: Handle genre IDs in TCON frames #286

Merged
merged 2 commits into from
Nov 5, 2023

Conversation

sublipri
Copy link
Contributor

@sublipri sublipri commented Nov 2, 2023

I played around with this and came up with an implementation that returns an iterator and avoids allocation. It seemed appropriate to change the genre getter for the Accessor impl to use the new method so that numeric IDs will be translated and multiple values joined with '/' as per get_text. That's done as a separate commit in case it's a problem.

One question is whether get_texts and get_text should behave the same as genres and genre for TCON frames? I think this could be done fairly cleanly by reworking GenresIter into a more generic MultiValueIter and using it in get_texts. I can add another commit to this PR to address that if necessary.

closes #281

@sublipri sublipri marked this pull request as ready for review November 2, 2023 01:14
return None;
};

let mut genres = genres.peekable();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should either always fail or always succeed.

Either use expect() at runtime or better require Peekable and implement it for GenreIter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how this can fail? I'll try implementing Peekable for GenreIter though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can gather directly implementing Peekable doesn't seem to be recommended and calling genres.peekable() should be fine unless I'm missing something.

@sublipri
Copy link
Contributor Author

sublipri commented Nov 5, 2023

Reworked the genre commit based on the feedback. Unless I'm missing something re: peekable or there are other problems I think this is okay to merge.

@Serial-ATA
Copy link
Owner

Yep, looks good to me. Thanks for working on this!

@Serial-ATA Serial-ATA merged commit ed623c4 into Serial-ATA:main Nov 5, 2023
@sublipri sublipri deleted the genre-ids branch November 5, 2023 04:03
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ID3v2: Handle genre IDs when parsing TCON frames
3 participants