media-export: Do not try to re-add container to db
authorJens Georg <mail@jensge.org>
Thu, 17 Sep 2009 10:44:59 +0000 (12:44 +0200)
committerJens Georg <mail@jensge.org>
Mon, 21 Sep 2009 11:02:09 +0000 (13:02 +0200)
src/plugins/media-export/rygel-media-export-harvester.vala

index 985c829..8d98685 100644 (file)
@@ -218,10 +218,14 @@ public class Rygel.MediaExportHarvester : GLib.Object {
             if (info.get_file_type () == FileType.DIRECTORY) {
                 this.origin = file;
                 monitor.monitor (file);
-                this.containers.push_tail (new DummyContainer (file,
-                                                               this.parent));
+                var container = new DummyContainer (file, this.parent);
+                this.containers.push_tail (container);
+
+                int64 timestamp;
+                if (!this.media_db.exists (container.id, out timestamp)) {
+                    this.media_db.save_object (container);
+                }
 
-                this.media_db.save_object (this.containers.peek_tail ());
                 Idle.add (this.on_idle);
             } else {
                 string id;
@@ -233,7 +237,9 @@ public class Rygel.MediaExportHarvester : GLib.Object {
             }
 
         } catch (Error err) {
-            warning ("Failed to harvest file %s", file.get_uri ());
+            warning ("Failed to harvest file %s: %s",
+                     file.get_uri (),
+                     err.message);
             harvested (file);
         }
     }