Deleting ID3v2 Frames
Festus Hagen
festushagenlists at yahoo.com
Wed Nov 30 07:22:40 UTC 2016
Thanks swave,
Your comment has pointed out the fact my example does not accurately portray my code.
I do add the desired frames to delete to a list then work from that list ... The following is a more accurate representation.
MPEG::File audioFile(fileName);
ID3v2::Tag *id3v2tag = audioFile.ID3v2Tag();
ID3v2::FrameList deleteList;
ID3v2::FrameList::ConstIterator it = id3v2tag->frameList().begin();
for(; it != id3v2tag->frameList().end(); ++it)
deleteList.append((*it));
ID3v2::FrameList::ConstIterator it = deleteList.begin();
for(; it != deleteList.end(); ++it)
id3v2tag->removeFrame((*it), true);
audioFile.save(MPEG::File::ID3v2, false, 3);
Sorry for the confusion.
-Enjoy
fh : )_~
----- Original Message -----
From: swave <swaverec at gmx.net>
To: Festus Hagen <festushagenlists at yahoo.com>; taglib-devel at kde.org
Sent: Wednesday, November 30, 2016 12:48 AM
Subject: Re: Deleting ID3v2 Frames
On 30.11.2016 05:35, Festus Hagen wrote:
> Hi all,
>
> Just noticed something, don't remember this being the case and would like confirmation.
>
> The inability to delete certain frames.
>
> Maybe I'm doing something wrong?
> The basics of the code is ...
>
> MPEG::File audioFile(fileName);
> ID3v2::Tag *id3v2tag = audioFile.ID3v2Tag();
> ID3v2::FrameList::ConstIterator it = id3v2tag->frameList().begin();
> for(; it != id3v2tag->frameList().end(); ++it)
>
> id3v2tag->removeFrame((*it), true);
> audioFile.save(MPEG::File::ID3v2, false, 3);
While walking through the list you modify the list.
What happens if you walk the list backwards? Or do
a id3.delall(frame)?
bye swave
More information about the taglib-devel
mailing list