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



commit 08151d89b5a6fa380b2272fbdcf267090c5dc269
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 be 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]