[easytag/wip/dsf-support] Strip additional ID3 date fields while saving



commit a2db08574b937bbaac05e2787fbd43666b240827
Author: David King <amigadave amigadave com>
Date:   Wed Nov 19 23:46:41 2014 +0000

    Strip additional ID3 date fields while saving
    
    Ensure that the year field in the UI is the only date field saved to an
    ID3v2.3 tag.

 src/tags/id3_tag.c |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/tags/id3_tag.c b/src/tags/id3_tag.c
index 5b0d82f..5a8cbce 100644
--- a/src/tags/id3_tag.c
+++ b/src/tags/id3_tag.c
@@ -217,6 +217,23 @@ et_id3tag_set_id3tag_from_file_tag (const File_Tag *FileTag,
      ********/
     while ( (id3_frame = ID3Tag_FindFrameWithID(id3_tag,ID3FID_YEAR)) )
         ID3Tag_RemoveFrame(id3_tag,id3_frame);
+
+    /* When libid3tag reads the year, it synthesizes a single date from several
+     * fields, including the obsolete (in ID3v2.4) TDAT and TIME frames. Delete
+     * the obsolete frames to ensure that the saved date matches the year field
+     * in the UI. */
+    while ((id3_frame = ID3Tag_FindFrameWithID (id3_tag,
+                                                ID3FID_DATE)))
+    {
+        ID3Tag_RemoveFrame (id3_tag, id3_frame);
+    }
+
+    while ((id3_frame = ID3Tag_FindFrameWithID (id3_tag,
+                                                ID3FID_TIME)))
+    {
+        ID3Tag_RemoveFrame (id3_tag, id3_frame);
+    }
+
     if (FileTag->year && g_utf8_strlen(FileTag->year, -1) > 0)
     {
         id3_frame = ID3Frame_NewID(ID3FID_YEAR);


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