On Tue, Mar 16, 2010 at 2:01 AM, Jeff Mitchell <span dir="ltr"><<a href="mailto:mitchell@kde.org">mitchell@kde.org</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
On 3/13/2010 1:28 PM, Новичков А.А. wrote:<br>
> TagLib::FLAC::File *f=new TagLib::FLAC::File(FILE_NAME(file));<br>
> {TagLib::Ogg::XiphComment *tag=f->xiphComment(false);<br>
> if (tag) {<br>
> TagLib::Ogg::FieldListMap map=tag->fieldListMap();<br>
> TagLib::StringList list;<br>
> for (TagLib::Ogg::FieldListMap::ConstIterator it =<br>
> map.begin(); it != map.end(); ++it)<br>
> list.append((*it).first);<br>
> for (TagLib::StringList::ConstIterator it=list.begin(); it!<br>
> =list.end(); ++it)<br>
> tag->removeField((*it));<br>
> } }<br>
> {TagLib::ID3v1::Tag *tag=f->ID3v1Tag(false);<br>
> if (tag) {<br>
> tag->setAlbum("");<br>
> tag->setArtist("");<br>
> tag->setComment("");<br>
> tag->setGenre("");<br>
> tag->setTitle("");<br>
> tag->setTrack(0);<br>
> tag->setYear(0);<br>
> } }<br>
> {TagLib::ID3v2::Tag *tag=f->ID3v2Tag(false);<br>
> if (tag) {<br>
> tag->setAlbum("");<br>
> tag->setArtist("");<br>
> tag->setComment("");<br>
> tag->setGenre("");<br>
> tag->setTitle("");<br>
> tag->setTrack(0);<br>
> tag->setYear(0);<br>
> TagLib::ID3v2::FrameListMap map =tag->frameListMap();<br>
> TagLib::List<TagLib::ByteVector> list;<br>
> for (TagLib::ID3v2::FrameListMap::ConstIterator it =<br>
> map.begin(); it != map.end(); ++it)<br>
> list.append((*it).first);<br>
> for (TagLib::List<TagLib::ByteVector>::ConstIterator<br>
> it=list.begin(); it!=list.end(); ++it)<br>
> tag->removeFrames((*it));<br>
> } }<br>
> f->save();<br>
> delete f;<br>
<br>
Setting the album/artist/genre/etc to an empty string doesn't strip the<br>
tag, it just makes it empty.<br>
<br>
Just use the various functions to go through the item maps or attribute<br>
maps and remove each item you find. You already do this for two of the<br>
formats above, but with a lot of needless code in front.<br>
<font color="#888888"><br>
--Jeff<br>
<br>
</font><br>_______________________________________________<br>
taglib-devel mailing list<br>
<a href="mailto:taglib-devel@kde.org">taglib-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/taglib-devel" target="_blank">https://mail.kde.org/mailman/listinfo/taglib-devel</a><br>
<br></blockquote><div> </div></div> It is true for stripping the xiph comment or ape tag, however I never successfully cleared the asf tag, taglib always leave<br>empty attributes of artist, comment, copyright, rating, title.<br>
<br clear="all"><br>-- <br>Best Regards<br>