Removing pictures from ID3v2 tag

Vitali Lovich vlovich at gmail.com
Thu Apr 5 07:01:44 CEST 2007


Are you sure that save is returning true?  It could be that if you still 
have a file handle open to the file in another application, then the 
code may fail to save the file depending on what kind of lock TagLib and 
the other app request.

Stefan Vunckx wrote:
> Hello,
>
> I seem to have some trouble removing pictures from an mp3's ID3v2 tag using 
> TagLib.
>
> This is my code:
>
> TagLib::MPEG::File file( ... );
> if ( file.ID3v2Tag() ) {
> TagLib::ID3v2::FrameList l= file.ID3v2Tag()->frameListMap()["APIC"];
> for( std::list<TagLib::ID3v2::Frame*>::iterator iter = l.begin(); iter != 
> l.end(); iter++ ) {
>   TagLib::ID3v2::AttachedPictureFrame *frame = 
> static_cast<TagLib::ID3v2::AttachedPictureFrame *>( *iter );
>   file.ID3v2Tag()->removeFrame( frame, TRUE );
> }
> file.save();
> }
>
> Is what I'm doing so wrong ? Ive tested this in my Qt application, using mp3s 
> who have 1 or more pictures attached, and although there are no error 
> messages, the images do not get removed either. If I reload the tags, the 
> images re-appear.
>
> If someone can point me to what it is I am missing, I would be grateful ! ;-)
> Please CC me as I am not on the taglib-devel list.
>
> Regards,
> Stefan Vunckx
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
>
>   


More information about the taglib-devel mailing list