[rhythmbox] rhythmdb: allow errors to be replaced by song entries (bug #539007)



commit 167355eb68ba577624623ae5f7f8c5949e34f69c
Author: Jonathan Matthew <jonathan d14n org>
Date:   Fri Jun 12 19:25:53 2009 +1000

    rhythmdb: allow errors to be replaced by song entries (bug #539007)
    
    We do normal imports by creating events with no entry type
    specified (for some reason); a logic bug in the metadata load processing
    code meant that in this case, an import error would never be deleted and
    replaced with a regular song entry.  Now torrent downloads and other
    types of transfer into the music library will eventually be imported
    correctly.

 rhythmdb/rhythmdb.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/rhythmdb/rhythmdb.c b/rhythmdb/rhythmdb.c
index fb03503..0858cc9 100644
--- a/rhythmdb/rhythmdb.c
+++ b/rhythmdb/rhythmdb.c
@@ -2283,6 +2283,9 @@ rhythmdb_process_metadata_load_real (RhythmDBEvent *event)
 	GTimeVal time;
 	const char *media_type;
 
+	if (event->entry_type == RHYTHMDB_ENTRY_TYPE_INVALID)
+		event->entry_type = RHYTHMDB_ENTRY_TYPE_SONG;
+
 	/*
 	 * always ignore anything with video in it, or anything
 	 * matching one of the media types we don't care about.
@@ -2333,8 +2336,7 @@ rhythmdb_process_metadata_load_real (RhythmDBEvent *event)
 	entry = rhythmdb_entry_lookup_by_location_refstring (event->db, event->real_uri);
 
 	if (entry != NULL) {
-		if ((event->entry_type != RHYTHMDB_ENTRY_TYPE_INVALID) &&
-		    (rhythmdb_entry_get_entry_type (entry) != event->entry_type)) {
+		if (rhythmdb_entry_get_entry_type (entry) != event->entry_type) {
 			/* switching from IGNORE to SONG or vice versa, recreate the entry */
 			rhythmdb_entry_delete (event->db, entry);
 			rhythmdb_add_timeout_commit (event->db, FALSE);
@@ -2343,8 +2345,6 @@ rhythmdb_process_metadata_load_real (RhythmDBEvent *event)
 	}
 
 	if (entry == NULL) {
-		if (event->entry_type == RHYTHMDB_ENTRY_TYPE_INVALID)
-			event->entry_type = RHYTHMDB_ENTRY_TYPE_SONG;
 
 		entry = rhythmdb_entry_new (event->db, event->entry_type, rb_refstring_get (event->real_uri));
 		if (entry == NULL) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]