[sound-juicer] Remove duplicate recording labels



commit adb0117ad1cf461afbfe83f6ba1d1f58086fef9b
Author: Phillip Wood <phillip wood dunelm org uk>
Date:   Thu May 22 11:08:49 2014 +0100

    Remove duplicate recording labels
    
    If a release has more than one catalog number on the same recording
    label then the label name is duplicated as it appears with each
    catalog number. As we're not using the catalog numbers skip adding the
    recording label to the list if it's already present.
    
    For an example album see
    https://musicbrainz.org/ws/2/release/082bc530-580c-4628-8aa9-9003118ffa8b?inc=labels

 libjuicer/sj-metadata-musicbrainz5.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/libjuicer/sj-metadata-musicbrainz5.c b/libjuicer/sj-metadata-musicbrainz5.c
index 7d490e2..e7c4e90 100644
--- a/libjuicer/sj-metadata-musicbrainz5.c
+++ b/libjuicer/sj-metadata-musicbrainz5.c
@@ -312,6 +312,7 @@ get_release_labels (Mb5Release *release)
   int i;
   char buffer[512]; /* for the GET() macro */
   GList *label_list = NULL;
+  GList *it = NULL;
 
   list = mb5_release_get_labelinfolist (release);
   if (list == NULL)
@@ -330,10 +331,17 @@ get_release_labels (Mb5Release *release)
     if (label == NULL)
       continue;
 
+    mb5_label_get_name (label, buffer, sizeof (buffer));
+    for (it = label_list; it != NULL; it = it->next) {
+      if (strcmp (((LabelDetails*) it->data)->name, buffer) == 0)
+        goto skip;
+    }
     label_data = g_new0 (LabelDetails, 1);
-    GET (label_data->name,     mb5_label_get_name,     label);
+    label_data->name = g_strdup (buffer);
     GET (label_data->sortname, mb5_label_get_sortname, label);
     label_list = g_list_prepend (label_list, label_data);
+  skip:
+    ;
   }
   label_list = g_list_reverse (label_list);
   return label_list;


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