taglib query

Mike Van rhijn mike.vanrhijn at yahoo.com
Tue Mar 22 10:09:36 CET 2011


I'm not sure if this is the right place to ask this question. If not, can 
someone please point me to the right place?

I'm using taglib 1.7 (I started a few weeks back with 1.6.3) to develop an 
application that can write ID3 tags. I found it pretty easy to use apart from 
one thing.

When using TagLib::ID3v2::Tag: the documentation says the following about 
virtual void TagLib::ID3v2::Tag::setAlbum     (     const String &      s     
 )      [virtual]

Sets the album to s. If s is String::null then this value will be cleared. 

I've found however that passing TagLib::String::null does not clear the tag.

The following is an exttract of teh code I'm using:

MPEG::File f([theFileUTF8String]);
ID3v2::Tag *mp3Tag = f.ID3v2Tag();

if (mp3Tag) {

mp3Tag->setAlbum([Album length] == 0 ? String::null : [Album 
bool result = f.save();
    if (result = NO) {
        NSLog(@"tag did not save");
    }else {
        NSLog(@"tag did save");

According to the logging the tag did save successfully, however upon reading the 
tag again the album field is still set to the old value before submitting 
String::null. I also changed the code to log whether the Album length is 
detected as 0 and whether String::null is indeed submitted and it is. I haven't 
tried this with all the set methods but found the same when using setComment. 
For setComment I even tried adding mp3Tag->removeFrames("COMM"); which should 
remove all comment frames. I then used setComment(String::null) afterwards but 
was still present and had the old value;

I'm doing this on MAC OS X using xcode. Can any body please advise where I'm 
going wrong? I found this while using taglib 1.6.3 and then downloaded 1.7 in 
the hope that it would resolve the issue;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/taglib-devel/attachments/20110322/2c90ab2f/attachment.htm 

More information about the taglib-devel mailing list