[easytag] Fix saving of ID3v1 genre when also using ID3v2.4



commit acc9db6ed544a2bb1b66d955adadfccbca3ae092
Author: David King <amigadave amigadave com>
Date:   Tue Oct 25 22:26:25 2016 +0100

    Fix saving of ID3v1 genre when also using ID3v2.4
    
    When writing ID3v2.4 tags using libid3tag and the id3v2-text-only-genre
    setting is disabled, ensure that only the ID3v2 genre field is
    converted to the bracketed form, so that valid genres are assigned to
    the ID3v1 genre field.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773443

 src/tags/id3v24_tag.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/tags/id3v24_tag.c b/src/tags/id3v24_tag.c
index 1c6c9c4..90156af 100644
--- a/src/tags/id3v24_tag.c
+++ b/src/tags/id3v24_tag.c
@@ -1112,16 +1112,23 @@ id3tag_write_file_v24tag (const ET_File *ETFile,
     if ((genre_value == ID3_INVALID_GENRE)
         || g_settings_get_boolean (MainSettings, "id3v2-text-only-genre"))
     {
-        string1 = g_strdup (FileTag->genre);
+        etag_set_tags (FileTag->genre, ID3_FRAME_GENRE,
+                       ID3_FIELD_TYPE_STRINGLIST, v1tag, v2tag, &strip_tags);
     }
     else
     {
+        /* The ID3v1 genre must always be given as a plain string, and
+         * libid3tag does the appropriate conversion. */
+        etag_set_tags (FileTag->genre, ID3_FRAME_GENRE,
+                       ID3_FIELD_TYPE_STRINGLIST, v1tag, NULL, &strip_tags);
+
+        /* Only the ID3v2 tag is converted to the bracketed form. */
         string1 = g_strdup_printf ("(%d)",genre_value);
+        etag_set_tags (string1, ID3_FRAME_GENRE,
+                       ID3_FIELD_TYPE_STRINGLIST, NULL, v2tag, &strip_tags);
+        g_free (string1);
     }
 
-    etag_set_tags(string1, ID3_FRAME_GENRE, ID3_FIELD_TYPE_STRINGLIST, v1tag, v2tag, &strip_tags);
-    g_free(string1);
-
     /***********
      * Comment *
      ***********/


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