summaryrefslogtreecommitdiff
path: root/libjuicer
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2012-06-19 11:14:08 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2013-04-10 15:23:34 +0200
commit067425730bb0ded5e1cbc3860a379d6e040ce4fe (patch)
treef1bb7cdf9b4c585c025783b35ad7d268092e64ff /libjuicer
parentb2f6bce46d6ae2e9d6f14e85f6af86bbd1db323a (diff)
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
Diffstat (limited to 'libjuicer')
-rw-r--r--libjuicer/sj-metadata-musicbrainz5.c35
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;