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

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Dec 15 11:33:43 EET 2008
Author: pvanhoof
Date: 2008-12-15 11:33:42 +0200 (Mon, 15 Dec 2008)
New Revision: 16952

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

	* daemon/utils.c: Filenames for album-art



Modified: projects/haf/trunk/hildon-thumbnail/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-thumbnail/ChangeLog	2008-12-12 14:27:50 UTC (rev 16951)
+++ projects/haf/trunk/hildon-thumbnail/ChangeLog	2008-12-15 09:33:42 UTC (rev 16952)
@@ -1,3 +1,7 @@
+2008-12-15  Philip Van Hoof  <philip at codeminded.be>
+
+	* daemon/utils.c: Filenames for album-art
+
 2008-12-12  Philip Van Hoof  <philip at codeminded.be>
 
 	* thumbs/hildon-albumart-obj.c: Error passing

Modified: projects/haf/trunk/hildon-thumbnail/daemon/utils.c
===================================================================
--- projects/haf/trunk/hildon-thumbnail/daemon/utils.c	2008-12-12 14:27:50 UTC (rev 16951)
+++ projects/haf/trunk/hildon-thumbnail/daemon/utils.c	2008-12-15 09:33:42 UTC (rev 16952)
@@ -234,45 +234,49 @@
 {
 	gchar *art_filename;
 	gchar *dir;
-	gchar *str;
-	gchar *down;
+	gchar *down1, *down2;
+	gchar *str1 = NULL, *str2 = NULL;
 	gchar *f_a = NULL, *f_b = NULL;
 
+	/* http://live.gnome.org/MediaArtStorageSpec */
+
 	*path = NULL;
 
 	if (!a && !b) {
 		return;
 	}
 
-	if (a)
+	if (a && strlen (a) > 1)
 		f_a = strip_characters (a);
+	else 
+		f_a = g_strdup ("  ");
 
-	if (b)
+	if (b && strlen (b) > 1)
 		f_b = strip_characters (b);
+	else
+		f_b = g_strdup ("  ");
 
-	str = g_strconcat (a ? f_a : "", 
-			   " ", 
-			   b ? f_b : "", 
-			   NULL);
 
+	down1 = g_utf8_strdown (f_a, -1);
+	down2 = g_utf8_strdown (f_b, -1);
+
 	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);
+	str1 = g_compute_checksum_for_string (G_CHECKSUM_MD5, down1, -1);
+	str2 = g_compute_checksum_for_string (G_CHECKSUM_MD5, down2, -1);
 
-	art_filename = g_strdup_printf ("%s-%s.jpeg", prefix?prefix:"album", str);
-	g_free (str);
+	g_free (down1);
+	g_free (down2);
 
+	art_filename = g_strdup_printf ("%s-%s-%s.jpeg", prefix?prefix:"album", str1, str2);
+
 	*path = g_build_filename (dir, art_filename, NULL);
 	g_free (dir);
 	g_free (art_filename);


More information about the maemo-commits mailing list