Summary: | Repeated genre in ID3v2.3 tag | ||
---|---|---|---|
Product: | [Frameworks and Libraries] taglib | Reporter: | Xavier Duret <xaviour.maillists> |
Component: | general | Assignee: | Scott Wheeler <wheeler> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | ID3v2.3 genre repeat fix |
Description
Xavier Duret
2007-02-14 14:00:15 UTC
Created attachment 19685 [details]
ID3v2.3 genre repeat fix
This is a simple fix for frames like:
(1)Rock
It does not solve the problems of "refinement" that is to say frames like
(4)Eurodisco
which should be parsed as "Eurodisco" and not "Disco Eurodisco".
SVN commit 648998 by wheeler: Switch to using a list of genres and checking for membership in there to avoid repeated values. Based on a patch from Xavier Duret. BUG:141679 M +8 -14 id3v2tag.cpp --- trunk/kdesupport/taglib/taglib/mpeg/id3v2/id3v2tag.cpp #648997:648998 @@ -141,10 +141,9 @@ StringList fields = f->fieldList(); - String genreString; - bool hasNumber = false; + StringList genres; - for(StringList::ConstIterator it = fields.begin(); it != fields.end(); ++it) { + for(StringList::Iterator it = fields.begin(); it != fields.end(); ++it) { bool isNumber = true; @@ -155,22 +154,17 @@ isNumber = *charIt >= '0' && *charIt <= '9'; } - if(!genreString.isEmpty()) - genreString.append(' '); - if(isNumber) { int number = (*it).toInt(); - if(number >= 0 && number <= 255) { - hasNumber = true; - genreString.append(ID3v1::genre(number)); - } + if(number >= 0 && number <= 255) + *it = ID3v1::genre(number); } - else { - genreString.append(*it); - } + + if(std::find(genres.begin(), genres.end(), *it) == genres.end()) + genres.append(*it); } - return genreString; + return genres.toString(); } TagLib::uint ID3v2::Tag::year() const |