[easytag/wip/taglib-mp4-cxx: 4/12] Support album artist in MP4 files



commit ae73293ff7d77ed10e66995a1c373aec31a9c3ad
Author: Santtu Lakkala <inz inz fi>
Date:   Thu Apr 10 09:32:42 2014 +0100

    Support album artist in MP4 files
    
    Use the atom directly, rather than going through the properties
    convenience API.

 src/easytag.c  |    2 --
 src/mp4_tag.cc |   28 +++++++++++++++++++++-------
 2 files changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/src/easytag.c b/src/easytag.c
index 92a5def..cbd3f55 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -4125,8 +4125,6 @@ void Tag_Area_Display_Controls (ET_File *ETFile)
 
 #ifdef ENABLE_MP4
         case MP4_TAG:
-            gtk_widget_hide (GTK_WIDGET (AlbumArtistLabel));
-            gtk_widget_hide (GTK_WIDGET (AlbumArtistEntry));
             gtk_widget_show (GTK_WIDGET (DiscNumberLabel));
             gtk_widget_show (GTK_WIDGET (DiscNumberEntry));
             gtk_widget_show (GTK_WIDGET (ComposerLabel));
diff --git a/src/mp4_tag.cc b/src/mp4_tag.cc
index 2434628..87a39e6 100644
--- a/src/mp4_tag.cc
+++ b/src/mp4_tag.cc
@@ -168,11 +168,20 @@ gboolean Mp4tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
         FileTag->encoded_by = g_strdup (encodedbys.front ().toCString (true));
     }
 
+    const TagLib::MP4::ItemListMap &extra_items = tag->itemListMap ();
+
+    /****************
+     * Album Artist *
+     ****************/
+    if (extra_items.contains ("aART"))
+    {
+        const TagLib::MP4::Item album_artists = extra_items["aART"];
+        FileTag->album_artist = g_strdup (album_artists.toStringList ().front ().toCString (true));
+    }
+
     /***********
      * Picture *
      ***********/
-    const TagLib::MP4::ItemListMap extra_items = tag->itemListMap ();
-
     if (extra_items.contains ("covr"))
     {
         const TagLib::MP4::Item cover = extra_items["covr"];
@@ -260,9 +269,6 @@ gboolean Mp4tag_Write_File_Tag (ET_File *ETFile)
         fields.insert ("ALBUM", string);
     }
 
-    /* Album artist. */
-    /* TODO: No album artist support in TagLib. */
-
     /* Disc number. */
     if (FileTag->disc_number && *(FileTag->disc_number))
     {
@@ -357,11 +363,19 @@ gboolean Mp4tag_Write_File_Tag (ET_File *ETFile)
         fields.insert ("ENCODEDBY", string);
     }
 
+    TagLib::MP4::ItemListMap &extra_items = tag->itemListMap ();
+
+    /* Album artist. */
+    /* FIXME: No "ALBUMARTIST" support in TagLib, use atom directly. */
+    if (FileTag->album_artist && *(FileTag->album_artist))
+    {
+        TagLib::String string (FileTag->album_artist, TagLib::String::UTF8);
+        extra_items.insert ("aART", TagLib::MP4::Item (string));
+    }
+
     /***********
      * Picture *
      ***********/
-    TagLib::MP4::ItemListMap &extra_items = tag->itemListMap ();
-
     if (FileTag->picture)
     {
         Picture_Format pf;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]