[maemo-commits] [maemo-commits] r16322 - in projects/haf/branches/hildon-thumbnail/daemonize: . daemon debian tests thumbs

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Oct 3 12:38:10 EEST 2008
Author: pvanhoof
Date: 2008-10-03 12:38:05 +0300 (Fri, 03 Oct 2008)
New Revision: 16322

Added:
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/com.nokia.albumart.service.in
   projects/haf/branches/hildon-thumbnail/daemonize/tests/artist-art-test.c
Modified:
   projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog
   projects/haf/branches/hildon-thumbnail/daemonize/configure.ac
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/Makefile.am
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.c
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.c
   projects/haf/branches/hildon-thumbnail/daemonize/debian/hildon-thumbnail.install
   projects/haf/branches/hildon-thumbnail/daemonize/tests/
   projects/haf/branches/hildon-thumbnail/daemonize/tests/Makefile.am
   projects/haf/branches/hildon-thumbnail/daemonize/thumbs/hildon-albumart-factory.c
Log:
2008-10-03  Philip Van Hoof  <pvanhoof at gnome.org>

	* daemon/Makefile.am
	* daemon/com.nokia.albumart.service.in
	* debian/hildon-thumbnail.install: Fixed installing service files for DBus
	* thumbs/hildon-albumart-factory.c: Fixed various things
	* tests/Makefile.am:
	* configure.ac:
	* tests/artist-art-test.c: Implemented demo for the albumart downloading
	* daemon/utils.c: Fixed filename determination
	* daemon/albumart.c: Fixed various things



Modified: projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog	2008-10-03 08:32:29 UTC (rev 16321)
+++ projects/haf/branches/hildon-thumbnail/daemonize/ChangeLog	2008-10-03 09:38:05 UTC (rev 16322)
@@ -1,3 +1,15 @@
+2008-10-03  Philip Van Hoof  <pvanhoof at gnome.org>
+
+	* daemon/Makefile.am
+	* daemon/com.nokia.albumart.service.in
+	* debian/hildon-thumbnail.install: Fixed installing service files for DBus
+	* thumbs/hildon-albumart-factory.c: Fixed various things
+	* tests/Makefile.am:
+	* configure.ac:
+	* tests/artist-art-test.c: Implemented demo for the albumart downloading
+	* daemon/utils.c: Fixed filename determination
+	* daemon/albumart.c: Fixed various things
+
 2008-10-01  Philip Van Hoof  <pvanhoof at gnome.org>
 
 	* thumbs/hildon-albumart-factory.c

Modified: projects/haf/branches/hildon-thumbnail/daemonize/configure.ac
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/configure.ac	2008-10-03 08:32:29 UTC (rev 16321)
+++ projects/haf/branches/hildon-thumbnail/daemonize/configure.ac	2008-10-03 09:38:05 UTC (rev 16322)
@@ -13,6 +13,9 @@
 
 AC_HEADER_STDC
 
+PKG_CHECK_MODULES(XML, libxml-2.0)
+AC_SUBST(XML_CFLAGS)
+AC_SUBST(XML_LIBS)
 
 PKG_CHECK_MODULES(DBUS, dbus-1 dbus-glib-1)
 AC_SUBST(DBUS_CFLAGS)
@@ -32,7 +35,12 @@
 AC_SUBST(GMODULE_CFLAGS)
 AC_SUBST(GMODULE_LIBS)
 
+PKG_CHECK_MODULES(GTK, gtk+-2.0, [have_gtk=yes], [have_gtk=no])
+AC_SUBST(GTK_CFLAGS)
+AC_SUBST(GTK_LIBS)
 
+AM_CONDITIONAL(HAVE_MGTK, test "$have_gtk" = "yes")
+
 ####################################################################
 # DBus Service
 ####################################################################


Property changes on: projects/haf/branches/hildon-thumbnail/daemonize/daemon
___________________________________________________________________
Name: svn:ignore
   - hildon-thumbnailer-plugin-runner
Makefile.in
hildon-thumbnailerd
.libs
.deps
org.freedesktop.thumbnailer.service
Makefile
*-glue.h
*-marshal.c
*-marshal.h


   + com.nokia.albumart.service
hildon-thumbnailer-plugin-runner
Makefile.in
hildon-thumbnailerd
.libs
.deps
org.freedesktop.thumbnailer.service
Makefile
*-glue.h
*-marshal.c
*-marshal.h




Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/Makefile.am
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/Makefile.am	2008-10-03 08:32:29 UTC (rev 16321)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/Makefile.am	2008-10-03 09:38:05 UTC (rev 16322)
@@ -69,6 +69,9 @@
 org.freedesktop.thumbnailer_servicedir = $(DBUS_SERVICES_DIR)
 org.freedesktop.thumbnailer_service_DATA = org.freedesktop.thumbnailer.service
 
+com.nokia.albumart_servicedir = $(DBUS_SERVICES_DIR)
+com.nokia.albumart_service_DATA = com.nokia.albumart.service
+
 %.service: %.service.in
 	@sed -e "s|@libexecdir[@]|${libexecdir}|" $< > $@
 

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.c	2008-10-03 08:32:29 UTC (rev 16321)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/albumart.c	2008-10-03 09:38:05 UTC (rev 16322)
@@ -143,7 +143,7 @@
 
 	if (album && artist) {
 		task->album = g_strdup (album);
-		task->artist = g_strdup (album);
+		task->artist = g_strdup (artist);
 	} if (uri)
 		task->uri = g_strdup (uri);
 

Added: projects/haf/branches/hildon-thumbnail/daemonize/daemon/com.nokia.albumart.service.in
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/com.nokia.albumart.service.in	2008-10-03 08:32:29 UTC (rev 16321)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/com.nokia.albumart.service.in	2008-10-03 09:38:05 UTC (rev 16322)
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=com.nokia.albumart
+Exec=@libexecdir@/hildon-thumbnailerd

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.c	2008-10-03 08:32:29 UTC (rev 16321)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/utils.c	2008-10-03 09:38:05 UTC (rev 16322)
@@ -98,15 +98,15 @@
 void
 hildon_thumbnail_util_get_albumart_path (const gchar *artist, const gchar *album, const gchar *uri, gchar **path)
 {
-	gchar ascii_digest[33];
-	gchar art_filename[128];
+	gchar *art_filename, *str;
 	static gchar *dir = NULL;
 	gchar *down;
 	
 	if (album && artist) {
-		gchar *both = g_strdup_printf ("%s %s", artist, album);
-		down = g_utf8_strdown (both, -1);
-		g_free (both);
+		gchar *_tmp14, *_tmp13;
+		down = g_utf8_strdown (_tmp14 = (g_strconcat ((_tmp13 = g_strconcat (artist, " ", NULL)), album, NULL)),-1);
+		g_free (_tmp14);
+		g_free (_tmp13);
 	} else if (uri)
 		down = g_strdup (uri);
 	else {
@@ -125,11 +125,13 @@
 	if(!g_file_test (dir, G_FILE_TEST_EXISTS))
 		g_mkdir_with_parents (dir, 0770);
 
-	md5_c_string (down, ascii_digest);
+	str = g_compute_checksum_for_string (G_CHECKSUM_MD5, down, -1);
 
-	g_sprintf (art_filename, "%s.png", ascii_digest);
+	art_filename = g_strdup_printf ("%s.jpeg", str);
 
 	*path = g_build_filename (dir, art_filename, NULL);
 
+	g_free (str);
+	g_free (art_filename);
 	g_free (down);
 }

Modified: projects/haf/branches/hildon-thumbnail/daemonize/debian/hildon-thumbnail.install
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/debian/hildon-thumbnail.install	2008-10-03 08:32:29 UTC (rev 16321)
+++ projects/haf/branches/hildon-thumbnail/daemonize/debian/hildon-thumbnail.install	2008-10-03 09:38:05 UTC (rev 16322)
@@ -11,6 +11,9 @@
 usr/share/hildon-thumbnail/thumbnailer.xml
 usr/share/hildon-thumbnail/albumart.xml
 usr/share/dbus-1/services/org.freedesktop.thumbnailer.service
+usr/share/dbus-1/services/com.nokia.albumart.service
+usr/share/dbus-1/services/com.nokia.albumart.GoogleImages.service
+usr/share/dbus-1/services/com.nokia.albumart.NokiaMusicStore.service
+usr/share/dbus-1/services/com.nokia.albumart.service
 usr/lib/hildon-thumbnailer/plugins/libhildon-thumbnailer-exec.so
 usr/lib/hildon-thumbnailer/plugins/libhildon-thumbnailer-gdkpixbuf.so
-


Property changes on: projects/haf/branches/hildon-thumbnail/daemonize/tests
___________________________________________________________________
Name: svn:ignore
   - Makefile.in
*-glue.h
hildon-thumbnail-tester
.libs
hildon-thumbnail-daemon-plugin-test
.deps
Makefile

   + artist-art-tester
Makefile.in
*-glue.h
hildon-thumbnail-tester
.libs
hildon-thumbnail-daemon-plugin-test
.deps
Makefile



Modified: projects/haf/branches/hildon-thumbnail/daemonize/tests/Makefile.am
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/tests/Makefile.am	2008-10-03 08:32:29 UTC (rev 16321)
+++ projects/haf/branches/hildon-thumbnail/daemonize/tests/Makefile.am	2008-10-03 09:38:05 UTC (rev 16322)
@@ -1,11 +1,19 @@
 INCLUDES = -I$(srcdir)/../thumbs -I$(srcdir)/.. $(PKG_CFLAGS) \
 	$(DBUS_CFLAGS) $(GLIB_CFLAGS) $(GMODULE_CFLAGS) $(GIO_CFLAGS) \
-	$(GDK_PIXBUF_CFLAGS)
+	$(GDK_PIXBUF_CFLAGS) $(GTK_CFLAGS)
 
 BUILT_SOURCES = daemon-glue.h
 
-bin_PROGRAMS = hildon-thumbnail-tester hildon-thumbnail-daemon-plugin-test
+bin_PROGRAMS = hildon-thumbnail-tester hildon-thumbnail-daemon-plugin-test $(instart)
 
+if HAVE_MGTK
+bin_PROGRAMS += artist-art-tester
+
+artist_art_tester_SOURCES = artist-art-test.c
+artist_art_tester_LDADD = $(top_builddir)/thumbs/libhildonthumbnail.la \
+	$(GTK_LIBS) 
+endif
+
 hildon_thumbnail_daemon_plugin_test_SOURCES = daemon.c daemon-glue.h
 hildon_thumbnail_daemon_plugin_test_LDADD = $(top_builddir)/thumbs/libhildonthumbnail.la
 	$(DBUS_LIBS) $(GLIB_LIBS) $(GMODULE_LIBS) $(GIO_LIBS)

Added: projects/haf/branches/hildon-thumbnail/daemonize/tests/artist-art-test.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/tests/artist-art-test.c	2008-10-03 08:32:29 UTC (rev 16321)
+++ projects/haf/branches/hildon-thumbnail/daemonize/tests/artist-art-test.c	2008-10-03 09:38:05 UTC (rev 16322)
@@ -0,0 +1,62 @@
+#include <gtk/gtk.h>
+#include <hildon-albumart-factory.h>
+
+GtkWindow *window;
+GtkHBox *box;
+GtkVBox *hbox;
+GtkImage *image;
+GtkEntry *atext;
+GtkEntry *btext;
+GtkButton *button;
+
+
+static void
+on_art_back (HildonAlbumartFactoryHandle handle, gpointer user_data, GdkPixbuf *albumart, GError *error)
+{
+	if (albumart) {
+		gtk_image_set_from_pixbuf (image, albumart);
+	}
+}
+
+static void
+on_button_clicked (GtkButton *button, gpointer user_data)
+{
+	gchar *album, *artist;
+
+	album = gtk_entry_get_text (btext);
+	artist = gtk_entry_get_text (atext);
+
+	hildon_albumart_factory_load(artist, album, NULL, on_art_back, NULL);
+}
+
+int
+main(int argc, char **argv) 
+{
+
+	gtk_init (&argc, &argv);
+
+	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	box = gtk_vbox_new (FALSE, 5);
+
+	hbox = gtk_hbox_new (FALSE, 5);
+
+	atext = gtk_entry_new ();
+	gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (atext), FALSE, TRUE, 0);
+	btext = gtk_entry_new ();
+	gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (btext), FALSE, TRUE, 0);
+
+	gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (hbox), FALSE, TRUE, 0);
+
+	image = gtk_image_new ();
+	gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (image), TRUE, TRUE, 0);
+
+	button = gtk_button_new_with_label ("Get album art");
+	gtk_box_pack_start (GTK_BOX (box), GTK_WIDGET (button), FALSE, TRUE, 0);
+
+	g_signal_connect (G_OBJECT (button), "clicked", 
+					  G_CALLBACK (on_button_clicked), NULL);
+
+	gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (box));
+	gtk_widget_show_all (GTK_WIDGET (window));
+	gtk_main();
+}

Modified: projects/haf/branches/hildon-thumbnail/daemonize/thumbs/hildon-albumart-factory.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/thumbs/hildon-albumart-factory.c	2008-10-03 08:32:29 UTC (rev 16321)
+++ projects/haf/branches/hildon-thumbnail/daemonize/thumbs/hildon-albumart-factory.c	2008-10-03 09:38:05 UTC (rev 16322)
@@ -317,8 +317,9 @@
 }
 
 HildonAlbumartFactoryHandle hildon_albumart_factory_load(
-				const gchar *uri, const gchar *artist,
+				const gchar *artist,
 				const gchar *album,
+				const gchar *uri,
 				HildonAlbumartFactoryFinishedCallback callback,
 				gpointer user_data)
 {
@@ -331,11 +332,14 @@
 
 	have_all = g_file_test (path, G_FILE_TEST_EXISTS);
 
-	item = g_new (ArtsItem, 1);
+	item = g_new0 (ArtsItem, 1);
 
-	item->uri = g_strdup(uri);
-	item->album = g_strdup(album);
-	item->artist = g_strdup(artist);
+	if (uri)
+		item->uri = g_strdup(uri);
+	if (album)
+		item->album = g_strdup(album);
+	if (artist)
+		item->artist = g_strdup(artist);
 	item->callback = callback;
 	item->user_data = user_data;
 	item->canceled = FALSE;


More information about the maemo-commits mailing list