[tracker/tracker-0.6] Performance improvement heurstic scan for album art
- From: Martyn James Russell <mr src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker/tracker-0.6] Performance improvement heurstic scan for album art
- Date: Tue, 12 May 2009 07:05:55 -0400 (EDT)
commit 56a0164623c04ab79215ca64a13d63bc963f17f4
Author: Philip Van Hoof <philip codeminded be>
Date: Tue May 12 10:54:35 2009 +0200
Performance improvement heurstic scan for album art
Don't try to open files that aren't PNG files.
---
src/libtracker-common/tracker-albumart.c | 48 +++++++++++++++--------------
1 files changed, 25 insertions(+), 23 deletions(-)
diff --git a/src/libtracker-common/tracker-albumart.c b/src/libtracker-common/tracker-albumart.c
index 79078d8..d92afc5 100644
--- a/src/libtracker-common/tracker-albumart.c
+++ b/src/libtracker-common/tracker-albumart.c
@@ -500,35 +500,37 @@ tracker_albumart_heuristic (const gchar *artist_,
g_object_unref (file_found);
} else {
#ifdef HAVE_GDKPIXBUF
- GdkPixbuf *pixbuf;
-
- found = g_build_filename (dirname, name, NULL);
- pixbuf = gdk_pixbuf_new_from_file (found, &error);
-
- if (error) {
- g_error_free (error);
- retval = FALSE;
- } else {
- if (!target) {
- tracker_albumart_get_path (artist,
- album,
- "album",
- NULL,
- &target,
- NULL);
- }
+ if (g_str_has_suffix (name, "png")) {
+ GdkPixbuf *pixbuf;
- gdk_pixbuf_save (pixbuf, target, "jpeg", &error, NULL);
+ found = g_build_filename (dirname, name, NULL);
+ pixbuf = gdk_pixbuf_new_from_file (found, &error);
- if (!error) {
- retval = TRUE;
- } else {
+ if (error) {
g_error_free (error);
retval = FALSE;
+ } else {
+ if (!target) {
+ tracker_albumart_get_path (artist,
+ album,
+ "album",
+ NULL,
+ &target,
+ NULL);
+ }
+
+ gdk_pixbuf_save (pixbuf, target, "jpeg", &error, NULL);
+
+ if (!error) {
+ retval = TRUE;
+ } else {
+ g_error_free (error);
+ retval = FALSE;
+ }
}
+
+ g_free (found);
}
-
- g_free (found);
#else /* HAVE_GDKPIXBUF */
retval = FALSE;
#endif /* HAVE_GDKPIXBUF */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]