[sound-juicer] Get labels from musicbrainz.



commit cea3f7b43dcd42dcff976d6821872f03d1519841
Author: Phillip Wood <phillip wood dunelm org uk>
Date:   Tue Jun 19 11:14:08 2012 +0100

    Get labels from musicbrainz.
    
    To disambiguate between albums with the same disc ID it would be
    useful to display the recording label. Parse the list of recording
    labels provided by musicbrainz and store them in AlbumDetails.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=674926

 libjuicer/sj-metadata-musicbrainz5.c |   35 ++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
---
diff --git a/libjuicer/sj-metadata-musicbrainz5.c b/libjuicer/sj-metadata-musicbrainz5.c
index 46b8ae8..9604449 100644
--- a/libjuicer/sj-metadata-musicbrainz5.c
+++ b/libjuicer/sj-metadata-musicbrainz5.c
@@ -183,6 +183,40 @@ get_artist_info (GList *artists, char **name, char **sortname, char **id)
   g_string_free (artist_name, FALSE);
 }
 
+static GList*
+get_release_labels (Mb5Release *release)
+{
+  Mb5LabelInfoList list;
+  int i;
+  char buffer[512]; /* for the GET() macro */
+  GList *label_list = NULL;
+
+  list = mb5_release_get_labelinfolist (release);
+  if (list == NULL)
+    return NULL;
+
+  for (i = 0; i < mb5_labelinfo_list_size (list); i++) {
+    Mb5LabelInfo info;
+    Mb5Label label;
+    LabelDetails *label_data;
+
+    info = mb5_labelinfo_list_item (list, i);
+    if (info == NULL)
+      continue;
+
+    label = mb5_labelinfo_get_label (info);
+    if (label == NULL)
+      continue;
+
+    label_data = g_new0 (LabelDetails, 1);
+    GET (label_data->name,     mb5_label_get_name,     label);
+    GET (label_data->sortname, mb5_label_get_sortname, label);
+    label_list = g_list_prepend (label_list, label_data);
+  }
+  label_list = g_list_reverse (label_list);
+  return label_list;
+}
+
 static void
 fill_album_composer (AlbumDetails *album)
 {
@@ -483,6 +517,7 @@ make_album_from_release (Mb5ReleaseGroup group,
   fill_album_composer (album);
   relationlists = mb5_release_get_relationlistlist (release);
   fill_relations (relationlists, album);
+  album->labels = get_release_labels (release);
 
   sj_mb5_album_details_dump (album);
   return album;


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