[easytag/easytag-2-2] Clear empty fields in MP4 tags



commit c331b17b78a83e60a34384158b22d03f79a01b55
Author: David King <amigadave amigadave com>
Date:   Mon Oct 20 23:19:15 2014 +0100

    Clear empty fields in MP4 tags
    
    The existing tag is loaded from the file and modified before being
    written out. For "extra" fields, including cover art and album artist,
    the existing tag field was preserved in the case that the corresponding
    tag field had been cleared from the UI. Fix this by explicitly removing
    the cleared tag field.

 src/mp4_tag.cc |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/mp4_tag.cc b/src/mp4_tag.cc
index 3fa1a68..fff26ed 100644
--- a/src/mp4_tag.cc
+++ b/src/mp4_tag.cc
@@ -429,6 +429,10 @@ gboolean Mp4tag_Write_File_Tag (ET_File *ETFile)
         TagLib::String string (FileTag->album_artist, TagLib::String::UTF8);
         extra_items.insert ("aART", TagLib::MP4::Item (string));
     }
+    else
+    {
+        extra_items.erase ("aART");
+    }
 
     /***********
      * Picture *
@@ -463,6 +467,10 @@ gboolean Mp4tag_Write_File_Tag (ET_File *ETFile)
         extra_items.insert ("covr",
                             TagLib::MP4::Item (TagLib::MP4::CoverArtList ().append (art)));
     }
+    else
+    {
+        extra_items.erase ("covr");
+    }
 
     tag->setProperties (fields);
     success = mp4file.save () ? TRUE : FALSE;


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