1
From 33074fa366a502e9b2106e44754c8ae9e9d4881b Mon Sep 17 00:00:00 2001
2
From: Robert Ancell <robert.ancell@canonical.com>
3
Date: Thu, 7 Jun 2012 15:18:32 +1200
4
Subject: [PATCH] audiocd: Add support for musicbrainz5
8
plugins/audiocd/Makefile.am | 8 +
9
plugins/audiocd/sj-metadata-getter.c | 6 +
10
plugins/audiocd/sj-metadata-musicbrainz5.c | 619 ++++++++++++++++++++++++++++
11
plugins/audiocd/sj-metadata-musicbrainz5.h | 56 +++
12
5 files changed, 703 insertions(+), 3 deletions(-)
13
create mode 100644 plugins/audiocd/sj-metadata-musicbrainz5.c
14
create mode 100644 plugins/audiocd/sj-metadata-musicbrainz5.h
16
diff --git a/configure.ac b/configure.ac
17
index 33efca8..c68c629 100644
20
@@ -51,6 +51,7 @@ GLIB_REQS=2.28.0
22
MUSICBRAINZ3_REQS=3.0.2
23
MUSICBRAINZ4_REQS=4.0.0
24
+MUSICBRAINZ5_REQS=5.0.0
25
TOTEM_PLPARSER_REQS=2.32.1
28
@@ -355,10 +356,14 @@ if test x"$enable_musicbrainz" != "xno"; then
29
AC_SUBST(MUSICBRAINZ3_CFLAGS)
30
AC_SUBST(MUSICBRAINZ3_LIBS)
32
- PKG_CHECK_MODULES(MUSICBRAINZ4, libmusicbrainz4 >= $MUSICBRAINZ4_REQS gconf-2.0, [have_musicbrainz4=yes], [have_musicbrainz4=no])
33
+ PKG_CHECK_MODULES(MUSICBRAINZ4, libmusicbrainz4 >= $MUSICBRAINZ4_REQS libdiscid gconf-2.0, [have_musicbrainz4=yes], [have_musicbrainz4=no])
34
AC_SUBST(MUSICBRAINZ4_CFLAGS)
35
AC_SUBST(MUSICBRAINZ4_LIBS)
37
+ PKG_CHECK_MODULES(MUSICBRAINZ5, libmusicbrainz5 >= $MUSICBRAINZ5_REQS libdiscid gconf-2.0, [have_musicbrainz5=yes], [have_musicbrainz5=no])
38
+ AC_SUBST(MUSICBRAINZ5_CFLAGS)
39
+ AC_SUBST(MUSICBRAINZ5_LIBS)
41
if test x"$have_musicbrainz3" = xyes; then
43
LIBS="$LIBS $MUSICBRAINZ3_LIBS"
44
@@ -374,16 +379,22 @@ if test x"$enable_musicbrainz" != "xno"; then
45
have_sj_metadata_getter=yes
48
+ if test x"$have_musicbrainz5" = xyes; then
49
+ AC_DEFINE([HAVE_MUSICBRAINZ5], 1, [Whether libmusicbrainz5 is available])
50
+ have_sj_metadata_getter=yes
53
if test x"$have_sj_metadata_getter" = xyes; then
54
AC_DEFINE([HAVE_SJ_METADATA_GETTER], 1, [Whether to use the sound-juicer metadata getter code])
56
if test x"$enable_musicbrainz" = xyes; then
57
- AC_MSG_ERROR([MusicBrainz requested, but neither libmusicbrainz3 nor libmusicbrainz4 are available])
58
+ AC_MSG_ERROR([MusicBrainz requested, but neither libmusicbrainz3, libmusicbrainz4 nor libmusicbrainz5 are available])
62
AM_CONDITIONAL([HAVE_MUSICBRAINZ3], [test "x$have_musicbrainz3" = "xyes"])
63
AM_CONDITIONAL([HAVE_MUSICBRAINZ4], [test "x$have_musicbrainz4" = "xyes"])
64
+AM_CONDITIONAL([HAVE_MUSICBRAINZ5], [test "x$have_musicbrainz5" = "xyes"])
65
AM_CONDITIONAL([HAVE_SJ_METADATA_GETTER], [test "x$have_sj_metadata_getter" = "xyes"])
68
@@ -900,7 +911,7 @@ else
69
AC_MSG_NOTICE([** Multimedia keys support is enabled])
72
-if test x"$have_musicbrainz3" = "xyes"; then
73
+if test x"$have_sj_metadata_getter" = "xyes"; then
74
AC_MSG_NOTICE([** MusicBrainz support is enabled])
76
AC_MSG_NOTICE([ MusicBrainz support is disabled])
77
diff --git a/plugins/audiocd/Makefile.am b/plugins/audiocd/Makefile.am
78
index e757d2d..473b9d6 100644
79
--- a/plugins/audiocd/Makefile.am
80
+++ b/plugins/audiocd/Makefile.am
81
@@ -50,6 +50,10 @@ if HAVE_MUSICBRAINZ4
82
libaudiocd_la_LIBADD +=$(MUSICBRAINZ4_LIBS)
83
INCLUDES += $(MUSICBRAINZ4_CFLAGS)
86
+libaudiocd_la_LIBADD +=$(MUSICBRAINZ5_LIBS)
87
+INCLUDES += $(MUSICBRAINZ5_CFLAGS)
90
libaudiocd_la_LIBADD += $(NULL)
92
@@ -77,6 +81,7 @@ SJ_FILES = \
93
sj-metadata-getter.c sj-metadata-getter.h \
94
sj-metadata-musicbrainz3.c sj-metadata-musicbrainz3.h \
95
sj-metadata-musicbrainz4.c sj-metadata-musicbrainz4.h \
96
+ sj-metadata-musicbrainz5.c sj-metadata-musicbrainz5.h \
97
sj-structures.c sj-structures.h \
98
sj-metadata-marshal.list
100
@@ -101,6 +106,9 @@ endif
102
libaudiocd_la_SOURCES += sj-metadata-musicbrainz4.c sj-metadata-musicbrainz4.h
104
+if HAVE_MUSICBRAINZ5
105
+libaudiocd_la_SOURCES += sj-metadata-musicbrainz5.c sj-metadata-musicbrainz5.h
108
MARSHALFILES += sj-metadata-marshal.h sj-metadata-marshal.c
110
diff --git a/plugins/audiocd/sj-metadata-getter.c b/plugins/audiocd/sj-metadata-getter.c
111
index cfc447d..80b4b0b 100644
112
--- a/plugins/audiocd/sj-metadata-getter.c
113
+++ b/plugins/audiocd/sj-metadata-getter.c
115
#include "sj-metadata-getter.h"
116
#include "sj-metadata-marshal.h"
117
#include "sj-metadata.h"
118
+#ifdef HAVE_MUSICBRAINZ5
119
+#include "sj-metadata-musicbrainz5.h"
120
+#endif /* HAVE_MUSICBRAINZ5 */
121
#ifdef HAVE_MUSICBRAINZ4
122
#include "sj-metadata-musicbrainz4.h"
123
#endif /* HAVE_MUSICBRAINZ4 */
124
@@ -178,6 +181,9 @@ lookup_cd (SjMetadataGetter *mdg)
125
GError *error = NULL;
126
gboolean found = FALSE;
128
+#ifdef HAVE_MUSICBRAINZ5
129
+ SJ_TYPE_METADATA_MUSICBRAINZ5,
130
+#endif /* HAVE_MUSICBRAINZ5 */
131
#ifdef HAVE_MUSICBRAINZ4
132
SJ_TYPE_METADATA_MUSICBRAINZ4,
133
#endif /* HAVE_MUSICBRAINZ4 */
134
diff --git a/plugins/audiocd/sj-metadata-musicbrainz5.c b/plugins/audiocd/sj-metadata-musicbrainz5.c
136
index 0000000..ab1fec7
138
+++ b/plugins/audiocd/sj-metadata-musicbrainz5.c
141
+ * sj-metadata-musicbrainz5.c
142
+ * Copyright (C) 2008 Ross Burton <ross@burtonini.com>
143
+ * Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
144
+ * Copyright (C) 2011 Christophe Fergeau <cfergeau@redhat.com>
145
+ * Copyright (C) 2012 Robert Ancell <robert.ancell@canonical.com>
147
+ * This library is free software; you can redistribute it and/or
148
+ * modify it under the terms of the GNU Library General Public
149
+ * License as published by the Free Software Foundation; either
150
+ * version 2 of the License, or (at your option) any later version.
152
+ * This library is distributed in the hope that it will be useful,
153
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
154
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
155
+ * Library General Public License for more details.
157
+ * You should have received a copy of the GNU Library General Public
158
+ * License along with this library; if not, write to the
159
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
160
+ * Boston, MA 02111-1307, USA.
163
+#ifdef HAVE_CONFIG_H
165
+#endif /* HAVE_CONFIG_H */
170
+#include <glib-object.h>
171
+#include <gconf/gconf-client.h>
172
+#include <discid/discid.h>
173
+#include <musicbrainz5/mb5_c.h>
175
+#include "sj-metadata-musicbrainz5.h"
176
+#include "sj-structures.h"
177
+#include "sj-error.h"
179
+#define GET(field, function, obj) { \
180
+ function (obj, buffer, sizeof (buffer)); \
183
+ if (*buffer == '\0') \
186
+ field = g_strdup (buffer); \
189
+#define GCONF_MUSICBRAINZ_SERVER "/apps/sound-juicer/musicbrainz_server"
190
+#define GCONF_PROXY_USE_PROXY "/system/http_proxy/use_http_proxy"
191
+#define GCONF_PROXY_HOST "/system/http_proxy/host"
192
+#define GCONF_PROXY_PORT "/system/http_proxy/port"
193
+#define GCONF_PROXY_USE_AUTHENTICATION "/system/http_proxy/use_authentication"
194
+#define GCONF_PROXY_USERNAME "/system/http_proxy/authentication_user"
195
+#define GCONF_PROXY_PASSWORD "/system/http_proxy/authentication_password"
196
+#define SJ_MUSICBRAINZ_USER_AGENT "libjuicer-"VERSION
204
+ int http_proxy_port;
205
+} SjMetadataMusicbrainz5Private;
207
+#define GET_PRIVATE(o) \
208
+ (G_TYPE_INSTANCE_GET_PRIVATE ((o), SJ_TYPE_METADATA_MUSICBRAINZ5, SjMetadataMusicbrainz5Private))
218
+static void metadata_interface_init (gpointer g_iface, gpointer iface_data);
220
+G_DEFINE_TYPE_WITH_CODE (SjMetadataMusicbrainz5,
221
+ sj_metadata_musicbrainz5,
223
+ G_IMPLEMENT_INTERFACE (SJ_TYPE_METADATA,
224
+ metadata_interface_init));
232
+sj_mb5_album_details_dump (AlbumDetails *details)
234
+ if (details->country)
235
+ g_print ("Country: %s\n", details->country);
237
+ g_print ("Type: %s\n", details->type);
238
+ if (details->lyrics_url)
239
+ g_print ("Lyrics URL: %s\n", details->lyrics_url);
242
+#define sj_mb5_album_details_dump(...)
246
+get_artist_list (Mb5ArtistCredit credit)
248
+ Mb5NameCreditList name_list;
251
+ char buffer[512]; /* for the GET macro */
253
+ if (credit == NULL)
256
+ name_list = mb5_artistcredit_get_namecreditlist (credit);
257
+ if (name_list == NULL) {
262
+ for (i = 0; i < mb5_namecredit_list_size (name_list); i++) {
263
+ Mb5NameCredit name_credit;
265
+ ArtistDetails *details;
267
+ name_credit = mb5_namecredit_list_item (name_list, i);
268
+ details = g_new0 (ArtistDetails, 1);
269
+ GET (details->joinphrase, mb5_namecredit_get_joinphrase, name_credit);
270
+ artists = g_list_prepend (artists, details);
271
+ artist = mb5_namecredit_get_artist (name_credit);
273
+ g_warning ("no Mb5Artist associated with Mb5NameCredit, falling back to Mb5NameCredit::name");
274
+ GET (details->name, mb5_namecredit_get_name, name_credit);
278
+ GET (details->id, mb5_artist_get_id, artist);
279
+ GET (details->name, mb5_artist_get_name, artist);
280
+ GET (details->sortname, mb5_artist_get_sortname, artist);
281
+ GET (details->disambiguation, mb5_artist_get_disambiguation, artist);
282
+ GET (details->gender, mb5_artist_get_gender, artist);
283
+ GET (details->country, mb5_artist_get_country, artist);
286
+ return g_list_reverse(artists);
290
+get_artist_info (GList *artists, char **name, char **sortname, char **id)
292
+ GString *artist_name;
294
+ unsigned int artist_count;
296
+ artist_name = g_string_new (NULL);
298
+ for (it = artists; it != NULL; it = it->next) {
299
+ ArtistDetails *details = (ArtistDetails *)it->data;
301
+ g_string_append (artist_name, details->name);
302
+ if (details->joinphrase != NULL)
303
+ g_string_append (artist_name, details->joinphrase);
306
+ if (artist_count != 1) {
307
+ g_warning ("multiple artists");
308
+ if (sortname != NULL)
313
+ ArtistDetails *details = (ArtistDetails *)artists->data;
314
+ if (sortname != NULL)
315
+ *sortname = g_strdup (details->sortname);
317
+ *id = g_strdup (details->id);
321
+ *name = artist_name->str;
323
+ g_string_free (artist_name, FALSE);
328
+fill_relations (Mb5RelationListList relations, AlbumDetails *album)
332
+ for (i = 0; i < mb5_relationlist_list_size (relations); i++) {
333
+ Mb5RelationList list = mb5_relationlist_list_item (relations, i);
334
+ for (j = 0; j < mb5_relation_list_size (list); j++) {
335
+ Mb5Relation relation;
336
+ char buffer[512]; /* for the GET() macro */
339
+ relation = mb5_relation_list_item (list, j);
340
+ if (relation == NULL)
343
+ GET (type, mb5_relation_get_type, relation);
344
+ if (type == NULL) {
347
+ if (g_str_equal (type, "wikipedia")) {
348
+ char *wikipedia = NULL;
349
+ GET (wikipedia, mb5_relation_get_target, relation);
350
+ if (wikipedia != NULL) {
351
+ g_free (album->wikipedia);
352
+ album->wikipedia = wikipedia;
354
+ } else if (g_str_equal (type, "discogs")) {
355
+ char *discogs = NULL;
356
+ GET (discogs, mb5_relation_get_target, relation);
357
+ if (discogs != NULL) {
358
+ g_free (album->discogs);
359
+ album->discogs = discogs;
361
+ } else if (g_str_equal (type, "lyrics")) {
362
+ char *lyrics = NULL;
363
+ GET (lyrics, mb5_relation_get_target, relation);
364
+ if (lyrics != NULL) {
365
+ g_free (album->lyrics_url);
366
+ album->lyrics_url = lyrics;
375
+fill_tracks_from_medium (Mb5Medium medium, AlbumDetails *album)
377
+ Mb5TrackList track_list;
380
+ char buffer[512]; /* for the GET() macro */
382
+ track_list = mb5_medium_get_tracklist (medium);
386
+ album->number = mb5_track_list_size (track_list);
390
+ for (i = 0; i < mb5_track_list_size (track_list); i++) {
392
+ Mb5ArtistCredit credit;
393
+ Mb5Recording recording;
394
+ TrackDetails *track;
396
+ mbt = mb5_track_list_item (track_list, i);
400
+ track = g_new0 (TrackDetails, 1);
402
+ track->album = album;
404
+ track->number = mb5_track_get_position (mbt);
405
+ recording = mb5_track_get_recording (mbt);
406
+ if (recording != NULL) {
407
+ GET (track->title, mb5_recording_get_title, recording);
408
+ GET (track->track_id, mb5_recording_get_id, recording);
409
+ track->duration = mb5_recording_get_length (recording) / 1000;
410
+ credit = mb5_recording_get_artistcredit (recording);
412
+ GET (track->title, mb5_track_get_title, mbt);
413
+ track->duration = mb5_track_get_length (mbt) / 1000;
414
+ credit = mb5_track_get_artistcredit (mbt);
419
+ artists = get_artist_list (credit);
421
+ get_artist_info (artists, &track->artist,
422
+ &track->artist_sortname,
423
+ &track->artist_id);
425
+ track->artists = artists;
427
+ if (track->artist == NULL)
428
+ track->artist = g_strdup (album->artist);
429
+ if (track->artist_sortname == NULL)
430
+ track->artist_sortname = g_strdup (album->artist_sortname);
431
+ if (track->artist_id == NULL)
432
+ track->artist_id = g_strdup (album->artist_id);
434
+ tracks = g_list_prepend (tracks, track);
436
+ album->tracks = g_list_reverse (tracks);
439
+static AlbumDetails *
440
+make_album_from_release (Mb5ReleaseGroup group,
441
+ Mb5Release release,
444
+ AlbumDetails *album;
445
+ Mb5ArtistCredit credit;
448
+ char buffer[512]; /* for the GET macro */
450
+ g_assert (release);
451
+ g_return_val_if_fail (medium != NULL, NULL);
453
+ album = g_new0 (AlbumDetails, 1);
455
+ GET (album->album_id, mb5_release_get_id, release);
456
+ GET (album->title, mb5_medium_get_title, medium);
457
+ if (album->title == NULL)
458
+ GET (album->title, mb5_release_get_title, release);
460
+ credit = mb5_release_get_artistcredit (release);
462
+ artists = get_artist_list (credit);
464
+ get_artist_info (artists, &album->artist,
465
+ &album->artist_sortname,
466
+ &album->artist_id);
468
+ album->artists = artists;
470
+ GET (date, mb5_release_get_date, release);
471
+ album->release_date = sj_metadata_helper_scan_date (date);
474
+ GET (album->asin, mb5_release_get_asin, release);
475
+ GET (album->country, mb5_release_get_country, release);
477
+ GET (album->type, mb5_releasegroup_get_primarytype, group);
478
+ if (g_str_has_suffix (album->type, "Spokenword")
479
+ || g_str_has_suffix (album->type, "Interview")
480
+ || g_str_has_suffix (album->type, "Audiobook")) {
481
+ album->is_spoken_word = TRUE;
483
+ fill_relations (mb5_releasegroup_get_relationlistlist(group), album);
486
+ album->disc_number = mb5_medium_get_position (medium);
487
+ fill_tracks_from_medium (medium, album);
488
+ fill_relations (mb5_release_get_relationlistlist (release), album);
490
+ sj_mb5_album_details_dump (album);
498
+mb5_list_albums (SjMetadata *metadata, char **url, GError **error)
500
+ SjMetadataMusicbrainz5Private *priv;
501
+ GList *albums = NULL;
502
+ Mb5ReleaseList releases;
503
+ Mb5Release release;
504
+ const char *discid = NULL;
507
+ g_return_val_if_fail (SJ_IS_METADATA_MUSICBRAINZ5 (metadata), NULL);
509
+ priv = GET_PRIVATE (metadata);
511
+ if (sj_metadata_helper_check_media (priv->cdrom, error) == FALSE) {
515
+ priv->disc = discid_new ();
516
+ if (priv->disc == NULL)
518
+ if (discid_read (priv->disc, priv->cdrom) == 0)
522
+ *url = g_strdup (discid_get_submission_url (priv->disc));
524
+ if (g_getenv("MUSICBRAINZ_FORCE_DISC_ID")) {
525
+ discid = g_getenv("MUSICBRAINZ_FORCE_DISC_ID");
527
+ discid = discid_get_id (priv->disc);
530
+ releases = mb5_query_lookup_discid(priv->mb, discid);
532
+ if (releases == NULL) {
536
+ if (mb5_release_list_size (releases) == 0) {
540
+ for (i = 0; i < mb5_release_list_size (releases); i++) {
541
+ AlbumDetails *album;
543
+ release = mb5_release_list_item (releases, i);
545
+ char *releaseid = NULL;
546
+ Mb5Release full_release;
549
+ GET(releaseid, mb5_release_get_id, release);
551
+ full_release = mb5_query_lookup_release (priv->mb, releaseid);
552
+ g_free (releaseid);
553
+ if (full_release) {
554
+ Mb5MediumList media;
555
+ Mb5Metadata metadata = NULL;
556
+ Mb5ReleaseGroup group;
559
+ group = mb5_release_get_releasegroup (full_release);
561
+ /* The release-group information we can extract from the
562
+ * lookup_release query doesn't have the url relations for the
563
+ * release-group, so run a separate query to get these urls
565
+ char *releasegroupid = NULL;
566
+ char *params_names[] = { "inc" };
567
+ char *params_values[] = { "artists url-rels" };
569
+ GET (releasegroupid, mb5_releasegroup_get_id, group);
570
+ metadata = mb5_query_query (priv->mb, "release-group", releasegroupid, "",
571
+ 1, params_names, params_values);
572
+ g_free (releasegroupid);
575
+ if (metadata && mb5_metadata_get_releasegroup (metadata))
576
+ group = mb5_metadata_get_releasegroup (metadata);
578
+ media = mb5_release_media_matching_discid (full_release, discid);
579
+ for (j = 0; j < mb5_medium_list_size (media); j++) {
581
+ medium = mb5_medium_list_item (media, j);
583
+ album = make_album_from_release (group, full_release, medium);
584
+ album->metadata_source = SOURCE_MUSICBRAINZ;
585
+ albums = g_list_append (albums, album);
588
+ mb5_metadata_delete (metadata);
589
+ mb5_medium_list_delete (media);
590
+ mb5_release_delete (full_release);
594
+ mb5_release_list_delete (releases);
603
+metadata_interface_init (gpointer g_iface, gpointer iface_data)
605
+ SjMetadataClass *klass = (SjMetadataClass*)g_iface;
607
+ klass->list_albums = mb5_list_albums;
611
+sj_metadata_musicbrainz5_init (SjMetadataMusicbrainz5 *self)
613
+ GConfClient *gconf_client;
614
+ gchar *server_name;
616
+ SjMetadataMusicbrainz5Private *priv;
618
+ priv = GET_PRIVATE (self);
620
+ gconf_client = gconf_client_get_default ();
622
+ server_name = gconf_client_get_string (gconf_client, GCONF_MUSICBRAINZ_SERVER, NULL);
624
+ if (server_name && (*server_name == '\0')) {
625
+ g_free (server_name);
626
+ server_name = NULL;
629
+ priv->mb = mb5_query_new (SJ_MUSICBRAINZ_USER_AGENT, server_name, 0);
630
+ g_free (server_name);
633
+ /* Set the HTTP proxy */
634
+ if (gconf_client_get_bool (gconf_client, GCONF_PROXY_USE_PROXY, NULL)) {
638
+ proxy_host = gconf_client_get_string (gconf_client, GCONF_PROXY_HOST, NULL);
639
+ mb5_query_set_proxyhost (priv->mb, proxy_host);
640
+ g_free (proxy_host);
642
+ port = gconf_client_get_int (gconf_client, GCONF_PROXY_PORT, NULL);
643
+ mb5_query_set_proxyport (priv->mb, port);
645
+ if (gconf_client_get_bool (gconf_client, GCONF_PROXY_USE_AUTHENTICATION, NULL)) {
646
+ char *username, *password;
648
+ username = gconf_client_get_string (gconf_client, GCONF_PROXY_USERNAME, NULL);
649
+ mb5_query_set_proxyusername (priv->mb, username);
652
+ password = gconf_client_get_string (gconf_client, GCONF_PROXY_PASSWORD, NULL);
653
+ mb5_query_set_proxypassword (priv->mb, password);
658
+ g_object_unref (gconf_client);
662
+sj_metadata_musicbrainz5_get_property (GObject *object, guint property_id,
663
+ GValue *value, GParamSpec *pspec)
665
+ SjMetadataMusicbrainz5Private *priv = GET_PRIVATE (object);
668
+ switch (property_id) {
670
+ g_value_set_string (value, priv->cdrom);
672
+ case PROP_PROXY_HOST:
673
+ g_value_set_string (value, priv->http_proxy);
675
+ case PROP_PROXY_PORT:
676
+ g_value_set_int (value, priv->http_proxy_port);
679
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
684
+sj_metadata_musicbrainz5_set_property (GObject *object, guint property_id,
685
+ const GValue *value, GParamSpec *pspec)
687
+ SjMetadataMusicbrainz5Private *priv = GET_PRIVATE (object);
690
+ switch (property_id) {
693
+ g_free (priv->cdrom);
694
+ priv->cdrom = g_value_dup_string (value);
696
+ case PROP_PROXY_HOST:
697
+ if (priv->http_proxy) {
698
+ g_free (priv->http_proxy);
700
+ priv->http_proxy = g_value_dup_string (value);
701
+ /* TODO: check this unsets the proxy if NULL, or should we pass "" ? */
702
+ mb5_query_set_proxyhost (priv->mb, priv->http_proxy);
704
+ case PROP_PROXY_PORT:
705
+ priv->http_proxy_port = g_value_get_int (value);
706
+ mb5_query_set_proxyport (priv->mb, priv->http_proxy_port);
709
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
714
+sj_metadata_musicbrainz5_finalize (GObject *object)
716
+ SjMetadataMusicbrainz5Private *priv;
718
+ priv = GET_PRIVATE (object);
720
+ if (priv->mb != NULL) {
721
+ mb5_query_delete (priv->mb);
724
+ if (priv->disc != NULL) {
725
+ discid_free (priv->disc);
728
+ g_free (priv->cdrom);
730
+ G_OBJECT_CLASS (sj_metadata_musicbrainz5_parent_class)->finalize (object);
734
+sj_metadata_musicbrainz5_class_init (SjMetadataMusicbrainz5Class *class)
736
+ GObjectClass *object_class = (GObjectClass*)class;
738
+ g_type_class_add_private (class, sizeof (SjMetadataMusicbrainz5Private));
740
+ object_class->get_property = sj_metadata_musicbrainz5_get_property;
741
+ object_class->set_property = sj_metadata_musicbrainz5_set_property;
742
+ object_class->finalize = sj_metadata_musicbrainz5_finalize;
744
+ g_object_class_override_property (object_class, PROP_DEVICE, "device");
745
+ g_object_class_override_property (object_class, PROP_PROXY_HOST, "proxy-host");
746
+ g_object_class_override_property (object_class, PROP_PROXY_PORT, "proxy-port");
755
+sj_metadata_musicbrainz5_new (void)
757
+ return g_object_new (SJ_TYPE_METADATA_MUSICBRAINZ5, NULL);
759
diff --git a/plugins/audiocd/sj-metadata-musicbrainz5.h b/plugins/audiocd/sj-metadata-musicbrainz5.h
761
index 0000000..3cd4c42
763
+++ b/plugins/audiocd/sj-metadata-musicbrainz5.h
766
+ * sj-metadata-musicbrainz5.h
767
+ * Copyright (C) 2008 Ross Burton <ross@burtonini.com>
768
+ * Copyright (C) 2008 Bastien Nocera <hadess@hadess.net>
770
+ * This library is free software; you can redistribute it and/or
771
+ * modify it under the terms of the GNU Library General Public
772
+ * License as published by the Free Software Foundation; either
773
+ * version 2 of the License, or (at your option) any later version.
775
+ * This library is distributed in the hope that it will be useful,
776
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
777
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
778
+ * Library General Public License for more details.
780
+ * You should have received a copy of the GNU Library General Public
781
+ * License along with this library; if not, write to the
782
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
783
+ * Boston, MA 02111-1307, USA.
786
+#ifndef SJ_METADATA_MUSICBRAINZ5_H
787
+#define SJ_METADATA_MUSICBRAINZ5_H
789
+#include <glib-object.h>
790
+#include "sj-metadata.h"
794
+#define SJ_TYPE_METADATA_MUSICBRAINZ5 (sj_metadata_musicbrainz5_get_type ())
795
+#define SJ_METADATA_MUSICBRAINZ5(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SJ_TYPE_METADATA_MUSICBRAINZ5, SjMetadataMusicbrainz5))
796
+#define SJ_METADATA_MUSICBRAINZ5_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), SJ_TYPE_METADATA_MUSICBRAINZ5, SjMetadataMusicbrainz5Class))
797
+#define SJ_IS_METADATA_MUSICBRAINZ5(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SJ_TYPE_METADATA_MUSICBRAINZ5))
798
+#define SJ_IS_METADATA_MUSICBRAINZ5_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), SJ_TYPE_METADATA_MUSICBRAINZ5))
799
+#define SJ_METADATA_MUSICBRAINZ5_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SJ_TYPE_METADATA_MUSICBRAINZ5, SjMetadataMusicbrainz5Class))
801
+typedef struct _SjMetadataMusicbrainz5 SjMetadataMusicbrainz5;
802
+typedef struct _SjMetadataMusicbrainz5Class SjMetadataMusicbrainz5Class;
804
+struct _SjMetadataMusicbrainz5
809
+struct _SjMetadataMusicbrainz5Class
811
+ GObjectClass parent;
814
+GType sj_metadata_musicbrainz5_get_type (void);
816
+GObject *sj_metadata_musicbrainz5_new (void);
820
+#endif /* SJ_METADATA_MUSICBRAINZ5_H */