changeset 2558:fb2856249629

now path can be specified for cddb lookup via http.
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Sat, 10 May 2008 13:41:06 +0900
parents f0c34c3b61c0
children a3fecbacf65d
files src/cdaudio-ng/cdaudio-ng.c src/cdaudio-ng/configure.c src/cdaudio-ng/configure.h
diffstat 3 files changed, 27 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/cdaudio-ng/cdaudio-ng.c	Sat May 10 03:08:07 2008 +0300
+++ b/src/cdaudio-ng/cdaudio-ng.c	Sat May 10 13:41:06 2008 +0900
@@ -155,6 +155,7 @@
 	cdng_cfg.debug = FALSE;
 	cdng_cfg.device = g_strdup("");
 	cdng_cfg.cddb_server = g_strdup(CDDA_DEFAULT_CDDB_SERVER);
+	cdng_cfg.cddb_path = g_strdup("");
 	cdng_cfg.cddb_port = CDDA_DEFAULT_CDDB_PORT;
 	cdng_cfg.cddb_http = FALSE;
 	cdng_cfg.limitspeed = CDDA_DEFAULT_LIMIT_SPEED;
@@ -185,6 +186,7 @@
 	aud_cfg_db_get_bool(db, "CDDA", "debug", &cdng_cfg.debug);
 	aud_cfg_db_get_string(db, "CDDA", "device", &cdng_cfg.device);
 	aud_cfg_db_get_string(db, "CDDA", "cddbserver", &cdng_cfg.cddb_server);
+	aud_cfg_db_get_string(db, "CDDA", "cddbpath", &cdng_cfg.cddb_path);
 	aud_cfg_db_get_int(db, "CDDA", "cddbport", &cdng_cfg.cddb_port);
 	aud_cfg_db_get_bool(db, "CDDA", "cddbhttp", &cdng_cfg.cddb_http);
 	aud_cfg_db_get_int(db, "CDDA", "limitspeed", &cdng_cfg.limitspeed);
@@ -196,9 +198,9 @@
 
 	aud_cfg_db_close(db);
 
-	debug("use_dae = %d, limitspeed = %d, use_cdtext = %d, use_cddb = %d, cddbserver = \"%s\", cddbport = %d, cddbhttp = %d, device = \"%s\", debug = %d\n",
+	debug("use_dae = %d, limitspeed = %d, use_cdtext = %d, use_cddb = %d, cddbserver = \"%s\", cddbpath = \"%s\", cddbport = %d, cddbhttp = %d, device = \"%s\", debug = %d\n",
 		cdng_cfg.use_dae, cdng_cfg.limitspeed, cdng_cfg.use_cdtext, cdng_cfg.use_cddb,
-		cdng_cfg.cddb_server, cdng_cfg.cddb_port, cdng_cfg.cddb_http, cdng_cfg.device, cdng_cfg.debug);
+          cdng_cfg.cddb_server, cdng_cfg.cddb_path, cdng_cfg.cddb_port, cdng_cfg.cddb_http, cdng_cfg.device, cdng_cfg.debug);
 
 	menu_item_text = _("Rescan CD");
 	main_menu_item = gtk_image_menu_item_new_with_label(menu_item_text);
@@ -255,9 +257,9 @@
 
 	configure_show_gui();
 
-	debug("use_dae = %d, limitspeed = %d, use_cdtext = %d, use_cddb = %d, cddbserver = \"%s\", cddbport = %d, cddbhttp = %d, device = \"%s\", debug = %d\n",
+	debug("use_dae = %d, limitspeed = %d, use_cdtext = %d, use_cddb = %d, cddbserver = \"%s\", cddbpath = \"%s\", cddbport = %d, cddbhttp = %d, device = \"%s\", debug = %d\n",
 		cdng_cfg.use_dae, cdng_cfg.limitspeed, cdng_cfg.use_cdtext, cdng_cfg.use_cddb,
-		cdng_cfg.cddb_server, cdng_cfg.cddb_port, cdng_cfg.cddb_http, cdng_cfg.device, cdng_cfg.debug);
+		cdng_cfg.cddb_server, cdng_cfg.cddb_path, cdng_cfg.cddb_port, cdng_cfg.cddb_http, cdng_cfg.device, cdng_cfg.debug);
 }
 
 static gint cdaudio_is_our_file(gchar *filename)
@@ -589,6 +591,7 @@
 	aud_cfg_db_set_bool(db, "CDDA", "use_cdtext", cdng_cfg.use_cdtext);
 	aud_cfg_db_set_bool(db, "CDDA", "use_cddb", cdng_cfg.use_cddb);
 	aud_cfg_db_set_string(db, "CDDA", "cddbserver", cdng_cfg.cddb_server);
+	aud_cfg_db_set_string(db, "CDDA", "cddbpath", cdng_cfg.cddb_path);
 	aud_cfg_db_set_int(db, "CDDA", "cddbport", cdng_cfg.cddb_port);
 	aud_cfg_db_set_bool(db, "CDDA", "cddbhttp", cdng_cfg.cddb_http);
 	aud_cfg_db_set_string(db, "CDDA", "device", cdng_cfg.device);
@@ -982,6 +985,7 @@
 						cddb_http_enable(pcddb_conn);
 						cddb_set_server_name(pcddb_conn, cdng_cfg.cddb_server);
 						cddb_set_server_port(pcddb_conn, cdng_cfg.cddb_port);
+                        cddb_set_http_path_query(pcddb_conn, cdng_cfg.cddb_path);
 					}
 					else {
 						cddb_set_server_name(pcddb_conn, cdng_cfg.cddb_server);
--- a/src/cdaudio-ng/configure.c	Sat May 10 03:08:07 2008 +0300
+++ b/src/cdaudio-ng/configure.c	Sat May 10 13:41:06 2008 +0900
@@ -23,8 +23,10 @@
                  *usecdtextcheckbutton = NULL,
                  *usecddbcheckbutton = NULL,
                  *cddbserverlabel = NULL,
+                 *cddbpathlabel = NULL,
                  *cddbportlabel = NULL,
                  *cddbserverentry = NULL,
+                 *cddbpathentry = NULL,
                  *cddbportentry = NULL,
                  *cddbhttpcheckbutton = NULL,
                  *usedevicecheckbutton = NULL,
@@ -50,9 +52,11 @@
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton), cdng_cfg.use_cddb);
 
 	gtk_entry_set_text(GTK_ENTRY(cddbserverentry), cdng_cfg.cddb_server);
+	gtk_entry_set_text(GTK_ENTRY(cddbpathentry), cdng_cfg.cddb_path);
 	g_snprintf(portstr, sizeof(portstr), "%d", cdng_cfg.cddb_port);
 	gtk_entry_set_text(GTK_ENTRY(cddbportentry), portstr);
 	gtk_widget_set_sensitive(cddbserverentry, cdng_cfg.use_cddb);
+	gtk_widget_set_sensitive(cddbpathentry, cdng_cfg.use_cddb);
 	gtk_widget_set_sensitive(cddbportentry, cdng_cfg.use_cddb);
 	
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cddbhttpcheckbutton), cdng_cfg.cddb_http);
@@ -79,6 +83,7 @@
 	cdng_cfg.use_cdtext = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecdtextcheckbutton));
 	cdng_cfg.use_cddb = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton));
 	pstrcpy(&cdng_cfg.cddb_server, gtk_entry_get_text(GTK_ENTRY(cddbserverentry)));
+	pstrcpy(&cdng_cfg.cddb_path, gtk_entry_get_text(GTK_ENTRY(cddbpathentry)));
 	cdng_cfg.cddb_http = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(cddbhttpcheckbutton));
 	cdng_cfg.cddb_port = strtol(gtk_entry_get_text(GTK_ENTRY(cddbportentry)), NULL, 10);
 	
@@ -121,6 +126,9 @@
 	gtk_widget_set_sensitive(cddbserverentry,
 		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton)));
 
+	gtk_widget_set_sensitive(cddbpathentry,
+		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton)));
+
 	gtk_widget_set_sensitive(cddbhttpcheckbutton,
 		gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(usecddbcheckbutton)));
 	
@@ -194,18 +202,24 @@
 	cddbserverlabel = gtk_label_new(_("Server: "));
 	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbserverlabel, 0, 1, 2, 3);
 
+	cddbpathlabel = gtk_label_new(_("Path: "));
+	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbpathlabel, 0, 1, 3, 4);
+
 	cddbportlabel = gtk_label_new(_("Port: "));
-	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbportlabel, 0, 1, 3, 4);
+	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbportlabel, 0, 1, 4, 5);
 
 	cddbserverentry = gtk_entry_new();
 	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbserverentry, 1, 2, 2, 3);
 
+	cddbpathentry = gtk_entry_new();
+	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbpathentry, 1, 2, 3, 4);
+
 	cddbhttpcheckbutton = gtk_check_button_new_with_label(_("Use HTTP instead of CDDBP"));
 	g_signal_connect(G_OBJECT(cddbhttpcheckbutton), "toggled", G_CALLBACK(checkbutton_toggled), NULL);
 	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbhttpcheckbutton, 1, 2, 1, 2);
 
 	cddbportentry = gtk_entry_new();
-	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbportentry, 1, 2, 3, 4);
+	gtk_table_attach_defaults(GTK_TABLE(titleinfotable), cddbportentry, 1, 2, 4, 5);
 
 
 	usedevicecheckbutton = gtk_check_button_new_with_label(_("Override default device: "));
@@ -240,9 +254,11 @@
 	gtk_widget_show(usecdtextcheckbutton);
 	gtk_widget_show(usecddbcheckbutton);
 	gtk_widget_show(cddbserverentry);
+	gtk_widget_show(cddbpathentry);
 	gtk_widget_show(cddbhttpcheckbutton);
 	gtk_widget_show(cddbportentry);
 	gtk_widget_show(cddbserverlabel);
+	gtk_widget_show(cddbpathlabel);
 	gtk_widget_show(cddbportlabel);
 	gtk_widget_show(usedevicecheckbutton);
 	gtk_widget_show(deviceentry);
--- a/src/cdaudio-ng/configure.h	Sat May 10 03:08:07 2008 +0300
+++ b/src/cdaudio-ng/configure.h	Sat May 10 13:41:06 2008 +0900
@@ -10,6 +10,7 @@
 	gboolean	debug;
 	gchar		*device;
 	gchar		*cddb_server;
+	gchar		*cddb_path;
 	gint		cddb_port;
 	gboolean	cddb_http;
 	gint		limitspeed;