All pastes #514064 Raw Edit

Miscellany

public text v1 · immutable
#514064 ·published 2007-05-27 15:09 UTC
rendered paste body
Index: mythmusic/metaiotaglib.h
===================================================================
--- mythmusic/metaiotaglib.h	(revision 13509)
+++ mythmusic/metaiotaglib.h	(working copy)
@@ -12,6 +12,7 @@
 using TagLib::MPEG::File;
 using TagLib::Tag;
 using TagLib::ID3v2::UserTextIdentificationFrame;
+using TagLib::ID3v2::TextIdentificationFrame;
 using TagLib::ID3v2::AttachedPictureFrame;
 using TagLib::String;
 using TagLib::MPEG::Properties;
Index: mythmusic/metaiotaglib.cpp
===================================================================
--- mythmusic/metaiotaglib.cpp	(revision 13509)
+++ mythmusic/metaiotaglib.cpp	(working copy)
@@ -55,8 +55,19 @@
         if (!mdata->CompilationArtist().isEmpty())
         {
             // Compilation Artist (TPE4)
-            taglib->ID3v2Tag()->frameListMap()["TPE4"].front()->setText(
-                QStringToTString(mdata->CompilationArtist()));
+            TextIdentificationFrame *tpeframe;
+
+            TagLib::ID3v2::FrameList tpelist = taglib->ID3v2Tag()->frameListMap()["TPE4"];
+            if (!tpelist.isEmpty())
+            {
+                tpeframe = (TextIdentificationFrame *)tpelist.front();
+            }
+            else {
+                tpeframe = new TextIdentificationFrame(TagLib::ByteVector("TPE4"), TagLib::String::UTF8);
+                taglib->ID3v2Tag()->addFrame(tpeframe);
+            }
+
+            tpeframe->setText(QStringToTString(mdata->CompilationArtist()));
         }
     }