[tracker] Bugfixes for album art heuristics
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Subject: [tracker] Bugfixes for album art heuristics
- Date: Wed, 13 May 2009 12:10:38 -0400 (EDT)
commit 25d27c2bc0a39105c475b0281b973105dddce28f
Author: Philip Van Hoof <philip codeminded be>
Date: Wed May 13 17:13:55 2009 +0200
Bugfixes for album art heuristics
---
src/libtracker-common/tracker-albumart.c | 52 ++++++++++++++++--------------
1 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/src/libtracker-common/tracker-albumart.c b/src/libtracker-common/tracker-albumart.c
index e592f31..f2599e6 100644
--- a/src/libtracker-common/tracker-albumart.c
+++ b/src/libtracker-common/tracker-albumart.c
@@ -400,13 +400,14 @@ tracker_albumart_heuristic (const gchar *artist_,
tracker_albumart_get_path (artist, album,
"album", NULL,
&target, NULL);
-
- file = g_file_new_for_path (target);
-
- g_file_copy_async (local_file, file, 0, 0,
- NULL, NULL, NULL, NULL, NULL);
-
- g_object_unref (file);
+ if (target) {
+ file = g_file_new_for_path (target);
+
+ g_file_copy_async (local_file, file, 0, 0,
+ NULL, NULL, NULL, NULL, NULL);
+
+ g_object_unref (file);
+ }
g_object_unref (local_file);
*copied = TRUE;
@@ -479,32 +480,34 @@ tracker_albumart_heuristic (const gchar *artist_,
if (g_str_has_suffix (name, "jpeg") ||
g_str_has_suffix (name, "jpg")) {
- GFile *file_found;
-
if (!target) {
tracker_albumart_get_path (artist, album,
"album", NULL,
&target, NULL);
}
- if (!file) {
+ if (!file && target) {
file = g_file_new_for_path (target);
}
-
- found = g_build_filename (dirname, name, NULL);
- file_found = g_file_new_for_path (found);
-
- g_file_copy (file_found, file, 0, NULL, NULL, NULL, &error);
-
- if (!error) {
- retval = TRUE;
- } else {
- g_error_free (error);
- retval = FALSE;
+
+ if (file) {
+ GFile *file_found;
+
+ found = g_build_filename (dirname, name, NULL);
+ file_found = g_file_new_for_path (found);
+ g_file_copy (file_found, file, 0, NULL, NULL, NULL, &error);
+
+ if (!error) {
+ retval = TRUE;
+ } else {
+ g_error_free (error);
+ error = NULL;
+ retval = FALSE;
+ }
+
+ g_free (found);
+ g_object_unref (file_found);
}
-
- g_free (found);
- g_object_unref (file_found);
} else {
#ifdef HAVE_GDKPIXBUF
if (g_str_has_suffix (name, "png")) {
@@ -515,6 +518,7 @@ tracker_albumart_heuristic (const gchar *artist_,
if (error) {
g_error_free (error);
+ error = NULL;
retval = FALSE;
} else {
if (!target) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]