[easytag: 3/3] Clear empty fields in MP4 tags



commit ded35bddf49b4353b5ff00b880ac6b904b434be6
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/tags/mp4_tag.cc |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/tags/mp4_tag.cc b/src/tags/mp4_tag.cc
index ab7a5ce..63119f9 100644
--- a/src/tags/mp4_tag.cc
+++ b/src/tags/mp4_tag.cc
@@ -441,6 +441,10 @@ mp4tag_write_file_tag (const 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 *
@@ -475,6 +479,10 @@ mp4tag_write_file_tag (const 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]