[PATCH 4/6] Change naming scheme for fields



TagLib uses "raw" item names in ItemListMap, and does not support extraneous
fields in Properties map. Keep using ItemListMap, but use the raw item names
instead.
---
 src/mp4_tag.cc | 27 +++++++++++++--------------
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/mp4_tag.cc b/src/mp4_tag.cc
index f051c7f..544a699 100644
--- a/src/mp4_tag.cc
+++ b/src/mp4_tag.cc
@@ -101,15 +101,14 @@ gboolean Mp4tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
     /****************
      * Album Artist *
      ****************/
-    if (extra_tag.contains ("ALBUMARTIST"))
+    if (extra_tag.contains ("aART"))
     {
-        const TagLib::MP4::Item album_artist = extra_tag["ALBUMARTIST"];
+        const TagLib::MP4::Item album_artist = extra_tag["aART"];
         FileTag->album_artist = g_strdup (album_artist.toStringList ().front ().toCString (true));
     }
 
     /* Disc number. */
-    /* TODO: Total disc number support. */
-    if (extra_tag.contains ("DISCNUMBER"))
+    if (extra_tag.contains ("disk"))
     {
         const TagLib::MP4::Item disc_number = extra_tag["DISCNUMBER"];
         FileTag->disc_number = et_disc_number_to_string (disc_number.toStringList ().front ().toInt ());
@@ -142,25 +141,25 @@ gboolean Mp4tag_Read_File_Tag (gchar *filename, File_Tag *FileTag)
     /**********************
      * Composer or Writer *
      **********************/
-    if (extra_tag.contains ("COMPOSER"))
+    if (extra_tag.contains ("\251wrt"))
     {
-        const TagLib::MP4::Item composer = extra_tag["COMPOSER"];
+        const TagLib::MP4::Item composer = extra_tag["\251wrt"];
         FileTag->composer = g_strdup (composer.toStringList ().front ().toCString (true));
     }
 
     /* Copyright. */
-    if (extra_tag.contains ("COPYRIGHT"))
+    if (extra_tag.contains ("cprt"))
     {
-        const TagLib::MP4::Item copyright = extra_tag["COPYRIGHT"];
+        const TagLib::MP4::Item copyright = extra_tag["cprt"];
         FileTag->copyright = g_strdup (copyright.toStringList ().front ().toCString (true));
     }
 
     /*****************
      * Encoding Tool *
      *****************/
-    if (extra_tag.contains ("ENCODEDBY"))
+    if (extra_tag.contains ("\251too"))
     {
-        const TagLib::MP4::Item encodedby = extra_tag["ENCODEDBY"];
+        const TagLib::MP4::Item encodedby = extra_tag["\251too"];
         FileTag->encoded_by = g_strdup (encodedby.toStringList ().front ().toCString (true));
     }
 
@@ -297,14 +296,14 @@ gboolean Mp4tag_Write_File_Tag (ET_File *ETFile)
     if (FileTag->composer && *(FileTag->composer))
     {
         TagLib::String string (FileTag->composer, TagLib::String::UTF8);
-        extra_tag.insert ("COMPOSER", TagLib::MP4::Item (string));
+        extra_tag.insert ("\251wrt", TagLib::MP4::Item (string));
     }
 
     /* Copyright. */
     if (FileTag->copyright && *(FileTag->copyright))
     {
         TagLib::String string (FileTag->copyright, TagLib::String::UTF8);
-        extra_tag.insert ("COPYRIGHT", TagLib::MP4::Item (string));
+        extra_tag.insert ("cprt", TagLib::MP4::Item (string));
     }
 
     /*****************
@@ -312,8 +311,8 @@ gboolean Mp4tag_Write_File_Tag (ET_File *ETFile)
      *****************/
     if (FileTag->encoded_by && *(FileTag->encoded_by))
     {
-        TagLib::String string (FileTag->composer, TagLib::String::UTF8);
-        extra_tag.insert ("ENCODEDBY", TagLib::MP4::Item (string));
+        TagLib::String string (FileTag->encoded_by, TagLib::String::UTF8);
+        extra_tag.insert ("\251too", TagLib::MP4::Item (string));
     }
 
     /***********
-- 
1.8.3.2



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