Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
//compile with gcc -o tagtest `pkg-config --cflags taglib` `pkg-config --libs taglib` tagtest.cpp
//this is a small Test Programm to test how TagLib handles multiple Id3V2 Tags (e.g. 2 Artist Tags)
#include "taglib/taglib.h"
#include "taglib/tag.h"
#include "taglib/id3v2frame.h"
#include "taglib/id3v2tag.h"
#include "taglib/mpegfile.h"
#include "taglib/tlist.h"
#include <taglib/tfile.h>
int main(int argc,char** argv) {
TagLib::MPEG::File f("test.mp3");
if (f.ID3v2Tag()) {
// Get the list of frames for a specific frame type
TagLib::ID3v2::FrameList l = f.ID3v2Tag()->frameListMap()["TPE1"];
if (!l.isEmpty()) {
for (TagLib::ID3v2::FrameList::ConstIterator it=l.begin();it!=l.end();++it) {
std::cout << (*it)->toString() << std::endl;
}
}
} else {
std:cout << "didn't find id3v2 tag";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.