Handling multiple genres in id3v2?
Sander Jansen
s.jansen at gmail.com
Fri Jan 7 21:44:11 CET 2011
On Fri, Jan 7, 2011 at 12:00 PM, Andrew Lake <jamboarder at gmail.com> wrote:
> On Fri, Jan 7, 2011 at 9:45 AM, Sander Jansen wrote:
>> * So how do we store multiple genres/tags, one TCON frame with
>> multiple strings or multiple TCON frames with one string each.
>
> Here's what I did (id3v2 is a TagLib::ID3v2::Tag*):
>
> Read genres:
> TagLib::ID3v2::TextIdentificationFrame *tFrame =
> dynamic_cast<TagLib::ID3v2::TextIdentificationFrame
> *>(id3v2->frameListMap()["TCON"].front());
> TagLib::StringList genres = tFrame->fieldList();
>
> Write genres:
> if (!id3v2->frameListMap()["TCON"].isEmpty()) {
> TagLib::ID3v2::TextIdentificationFrame *tFrame =
> dynamic_cast<TagLib::ID3v2::TextIdentificationFrame
> *>(id3v2->frameListMap()["TCON"].front());
> tFrame->setText(tValues);
> } else {
> TagLib::ID3v2::TextIdentificationFrame *tFrame = new
> TagLib::ID3v2::TextIdentificationFrame("TCON", TagLib::String::UTF8);
> id3v2->addFrame(tFrame);
> tFrame->setText(genres);
> }
>
Thanks. I knew how to do that. When you read them if needed don't
forget to convert the conversion from id3v1 genre id to text.
More information about the taglib-devel
mailing list