I'm wanting to batch edit the ID3V2 tags in around 1660 CDs worth of tracks, as I have metadata stored elsewhere. Part of this process involves adding a APIC tag with the contents of a JPEG file. Now, I have jumped through the various hoops to get everything working except one thing, namely, the artwork. Everything else (genre, album, track number, etc) work fine, and the tags are visible to iTunes and Windows Media Player. However, I am stumped as to how to add the artwork I thought that the sequence
TagLib::MPEG::File f(filename);
TagLib::ID3v2::Tag*t = f.ID3v2Tag();
// code omitted to initialise the ByteVector of data from file (which I checked!)
TagLib::ID3v2::AttachedPictureFrame* pF = new TagLib::ID3v2::AttachedPictureFrame();
pF->setData(jpegData);
pF->setMimeType("image/jpeg");
pF->setType(TagLib::ID3v2::AttachedPictureFrame::FrontCover);
t->addFrame(pF);
f.save(TagLib::MPEG::File::ID3v2,false,3);
should work, but it does not save my artwork :( If anyone has working C++ code that does work, I'd be very grateful.
Steve S Developer for hire