[easytag] Read extended Winamp 5.6 genres stored as integers



commit 130296b3ec381439b06691d226d1d1388661dd29
Author: David King <amigadave amigadave com>
Date:   Mon May 5 18:56:34 2014 +0100

    Read extended Winamp 5.6 genres stored as integers
    
    As libid3tag has not been updated in some time, the genre list is rather
    out of date. If an integer genre is found, and libid3tag does not find
    it in the index, try the EasyTAG index as a fallback.

 src/id3v24_tag.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/id3v24_tag.c b/src/id3v24_tag.c
index d933462..a25167c 100644
--- a/src/id3v24_tag.c
+++ b/src/id3v24_tag.c
@@ -48,6 +48,7 @@
 #ifdef ENABLE_MP3
 
 #include <id3tag.h>
+#include "genres.h"
 
 
 /****************
@@ -326,9 +327,20 @@ gboolean Id3tag_Read_File_Tag (const gchar *filename, File_Tag *FileTag)
                     FileTag->genre = g_strdup(string1);
             }
 
-            if (!FileTag->genre
-            && id3_genre_index(genre))
-                FileTag->genre = (gchar *)id3_ucs4_utf8duplicate(id3_genre_index(genre));
+            if (!FileTag->genre)
+            {
+                if (id3_genre_index (genre))
+                {
+                    FileTag->genre = (gchar *)id3_ucs4_utf8duplicate (id3_genre_index (genre));
+                }
+                else if (strcmp (genre_no (genre),
+                                 genre_no (ID3_INVALID_GENRE)) != 0)
+                {
+                    /* If the integer genre is not found in the (outdated)
+                     * libid3tag index, try the EasyTAG index instead. */
+                    FileTag->genre = g_strdup (genre_no (genre));
+                }
+            }
 
             g_free(string1);
         }


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