stripping tags from FLAC
Anthony Liu
quadamage at gmail.com
Tue Mar 16 07:23:05 CET 2010
On Tue, Mar 16, 2010 at 2:01 AM, Jeff Mitchell <mitchell at kde.org> wrote:
> On 3/13/2010 1:28 PM, Новичков А.А. wrote:
> > TagLib::FLAC::File *f=new TagLib::FLAC::File(FILE_NAME(file));
> > {TagLib::Ogg::XiphComment *tag=f->xiphComment(false);
> > if (tag) {
> > TagLib::Ogg::FieldListMap map=tag->fieldListMap();
> > TagLib::StringList list;
> > for (TagLib::Ogg::FieldListMap::ConstIterator it =
> > map.begin(); it != map.end(); ++it)
> > list.append((*it).first);
> > for (TagLib::StringList::ConstIterator it=list.begin(); it!
> > =list.end(); ++it)
> > tag->removeField((*it));
> > } }
> > {TagLib::ID3v1::Tag *tag=f->ID3v1Tag(false);
> > if (tag) {
> > tag->setAlbum("");
> > tag->setArtist("");
> > tag->setComment("");
> > tag->setGenre("");
> > tag->setTitle("");
> > tag->setTrack(0);
> > tag->setYear(0);
> > } }
> > {TagLib::ID3v2::Tag *tag=f->ID3v2Tag(false);
> > if (tag) {
> > tag->setAlbum("");
> > tag->setArtist("");
> > tag->setComment("");
> > tag->setGenre("");
> > tag->setTitle("");
> > tag->setTrack(0);
> > tag->setYear(0);
> > TagLib::ID3v2::FrameListMap map =tag->frameListMap();
> > TagLib::List<TagLib::ByteVector> list;
> > for (TagLib::ID3v2::FrameListMap::ConstIterator it =
> > map.begin(); it != map.end(); ++it)
> > list.append((*it).first);
> > for (TagLib::List<TagLib::ByteVector>::ConstIterator
> > it=list.begin(); it!=list.end(); ++it)
> > tag->removeFrames((*it));
> > } }
> > f->save();
> > delete f;
>
> Setting the album/artist/genre/etc to an empty string doesn't strip the
> tag, it just makes it empty.
>
> Just use the various functions to go through the item maps or attribute
> maps and remove each item you find. You already do this for two of the
> formats above, but with a lot of needless code in front.
>
> --Jeff
>
>
> _______________________________________________
> taglib-devel mailing list
> taglib-devel at kde.org
> https://mail.kde.org/mailman/listinfo/taglib-devel
>
>
It is true for stripping the xiph comment or ape tag, however I never
successfully cleared the asf tag, taglib always leave
empty attributes of artist, comment, copyright, rating, title.
--
Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20100316/ea2e572f/attachment.htm
More information about the taglib-devel
mailing list