[maemo-commits] [maemo-commits] r16968 - in projects/haf/trunk/hildon-thumbnail: . daemon

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Dec 16 12:43:29 EET 2008
Author: pvanhoof
Date: 2008-12-16 12:43:27 +0200 (Tue, 16 Dec 2008)
New Revision: 16968

Modified:
   projects/haf/trunk/hildon-thumbnail/ChangeLog
   projects/haf/trunk/hildon-thumbnail/daemon/Makefile.am
   projects/haf/trunk/hildon-thumbnail/daemon/utils.c
Log:
2008-12-16  Philip Van Hoof  <philip at codeminded.be>

	* daemon/utils.c
	* daemon/Makefile.am: ifdef for the old album-art paths



Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-thumbnail/ChangeLog	2008-12-16 09:25:52 UTC (rev 16967)
+++ projects/haf/trunk/hildon-thumbnail/ChangeLog	2008-12-16 10:43:27 UTC (rev 16968)
@@ -1,3 +1,8 @@
+2008-12-16  Philip Van Hoof  <philip at codeminded.be>
+
+	* daemon/utils.c
+	* daemon/Makefile.am: ifdef for the old album-art paths
+
 2008-12-15  Marius Vollmer  <marius.vollmer at nokia.com>
 
 	Released 3.0.15

Modified: projects/haf/trunk/hildon-thumbnail/daemon/Makefile.am
===================================================================
--- projects/haf/trunk/hildon-thumbnail/daemon/Makefile.am	2008-12-16 09:25:52 UTC (rev 16967)
+++ projects/haf/trunk/hildon-thumbnail/daemon/Makefile.am	2008-12-16 10:43:27 UTC (rev 16968)
@@ -8,7 +8,8 @@
 	-DTHUMBNAILERS_DIR=\""/usr/share/thumbnailers"\" \
 	-DALBUMARTERS_DIR=\""/usr/share/albumart-providers"\" \
 	-DPLUGINS_DIR=\""$(libdir)/hildon-thumbnailer/plugins"\" \
-	-DOUTPUTPLUGINS_DIR=\""$(libdir)/hildon-thumbnailer/output-plugins"\"
+	-DOUTPUTPLUGINS_DIR=\""$(libdir)/hildon-thumbnailer/output-plugins"\" \
+	-DOLD_ART_PATH
 
 
 noinst_LTLIBRARIES = libshared.la

Modified: projects/haf/trunk/hildon-thumbnail/daemon/utils.c
===================================================================
--- projects/haf/trunk/hildon-thumbnail/daemon/utils.c	2008-12-16 09:25:52 UTC (rev 16967)
+++ projects/haf/trunk/hildon-thumbnail/daemon/utils.c	2008-12-16 10:43:27 UTC (rev 16968)
@@ -232,8 +232,55 @@
 void
 hildon_thumbnail_util_get_albumart_path (const gchar *a, const gchar *b, const gchar *prefix, gchar **path)
 {
+#ifdef OLD_ART_PATH
 	gchar *art_filename;
 	gchar *dir;
+	gchar *str;
+	gchar *down;
+	gchar *f_a = NULL, *f_b = NULL;
+
+	*path = NULL;
+
+	if (!a && !b) {
+		return;
+	}
+
+	if (a)
+		f_a = strip_characters (a);
+
+	if (b)
+		f_b = strip_characters (b);
+
+	str = g_strconcat (a ? f_a : "", 
+			   " ", 
+			   b ? f_b : "", 
+			   NULL);
+
+	g_free (f_a);
+	g_free (f_b);
+
+	down = g_utf8_strdown (str, -1);
+	g_free (str);
+
+	dir = g_build_filename (g_get_user_cache_dir (), "media-art", NULL);
+
+	if (!g_file_test (dir, G_FILE_TEST_EXISTS)) {
+		g_mkdir_with_parents (dir, 0770);
+	}
+
+	str = g_compute_checksum_for_string (G_CHECKSUM_MD5, down, -1);
+	g_free (down);
+
+	art_filename = g_strdup_printf ("%s-%s.jpeg", prefix?prefix:"album", str);
+	g_free (str);
+
+	*path = g_build_filename (dir, art_filename, NULL);
+	g_free (dir);
+	g_free (art_filename);
+
+#else
+	gchar *art_filename;
+	gchar *dir;
 	gchar *down1, *down2;
 	gchar *str1 = NULL, *str2 = NULL;
 	gchar *f_a = NULL, *f_b = NULL;
@@ -280,4 +327,5 @@
 	*path = g_build_filename (dir, art_filename, NULL);
 	g_free (dir);
 	g_free (art_filename);
+#endif
 }


More information about the maemo-commits mailing list