c++ - taglib : how to edit Album Artist? -
how modify "album artist" field of mp3 file library taglib ? there similar :
f.tag()->setartist("blabla");
?
id3v2 doesn't support field called "album artist". itunes uses tpe2 frame, supposed be:
tpe2
'band/orchestra/accompaniment' frame used additional information performers in recording.
for complete list of frames see http://id3.org/id3v2.3.0#declared_id3v2_frames.
to write taglib, trick:
#include <mpegfile.h> #include <id3v2tag.h> #include <textidentificationframe.h> int main() { taglib::mpeg::file file("foo.mp3"); taglib::bytevector handle = "tpe2"; taglib::string value = "bar"; taglib::id3v2::tag *tag = file.id3v2tag(true); if(!tag->framelist(handle).isempty()) { tag->framelist(handle).front()->settext(value); } else { taglib::id3v2::textidentificationframe *frame = new taglib::id3v2::textidentificationframe(handle, taglib::string::utf8); tag->addframe(frame); frame->settext(value); } file.save(); return 0; }
if want remove frames, can do:
taglib::mpeg::file file("foo.mp3"); taglib::id3v2::tag *tag = file.id3v2tag(); if(tag) { tag->removeframes("tpe2"); file.save(); }
Comments
Post a Comment