-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Conversation
src/id3/v2/tag.rs
Outdated
return None; | ||
}; | ||
|
||
let mut genres = genres.peekable(); |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Reworked the |
Yep, looks good to me. Thanks for working on this! |
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 perget_text
. That's done as a separate commit in case it's a problem.One question is whether
get_texts
andget_text
should behave the same asgenres
andgenre
for TCON frames? I think this could be done fairly cleanly by reworkingGenresIter
into a more genericMultiValueIter
and using it inget_texts
. I can add another commit to this PR to address that if necessary.closes #281