From 067425730bb0ded5e1cbc3860a379d6e040ce4fe Mon Sep 17 00:00:00 2001 From: Phillip Wood Date: Tue, 19 Jun 2012 11:14:08 +0100 Subject: 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 file changed, 35 insertions(+) (limited to 'libjuicer') 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; -- cgit v1.2.3