[rygel] media-export: remove harvester if done harvesting
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] media-export: remove harvester if done harvesting
- Date: Wed, 9 Sep 2009 20:40:04 +0000 (UTC)
commit c48f820675cdd9f8d51dcc07672e568f32bebdb7
Author: Jens Georg <mail jensge org>
Date: Sun Jul 5 14:42:02 2009 +0200
media-export: remove harvester if done harvesting
.../media-export/rygel-media-export-harvester.vala | 5 ++---
.../rygel-media-export-root-container.vala | 14 +++++++++-----
2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala b/src/plugins/media-export/rygel-media-export-harvester.vala
index 09bb96f..f656ca3 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -87,8 +87,6 @@ public class Rygel.MediaExportHarvester : GLib.Object {
this.containers = new Queue<DummyContainer> ();
this.origin = null;
this.monitor = monitor;
-
- Idle.add (this.on_idle);
}
private void on_close_async (Object obj, AsyncResult res) {
@@ -223,7 +221,6 @@ public class Rygel.MediaExportHarvester : GLib.Object {
} else {
// nothing to do
harvested (this.origin);
- this.origin = null;
}
return false;
@@ -241,9 +238,11 @@ public class Rygel.MediaExportHarvester : GLib.Object {
this.parent));
this.media_db.save_object (this.containers.peek_tail ());
+ Idle.add (this.on_idle);
} else {
string id;
if (push_if_changed_or_unknown (file, info, out id)) {
+ Idle.add (this.on_idle);
this.origin = file;
this.containers.push_tail (this.parent);
}
diff --git a/src/plugins/media-export/rygel-media-export-root-container.vala b/src/plugins/media-export/rygel-media-export-root-container.vala
index 8988c37..a6d089d 100644
--- a/src/plugins/media-export/rygel-media-export-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-root-container.vala
@@ -25,7 +25,7 @@ using Gee;
*/
public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
private MetadataExtractor extractor;
- private ArrayList<MediaExportHarvester> harvester;
+ private HashMap<File, MediaExportHarvester> harvester;
private MediaExportRecursiveFileMonitor monitor;
private ArrayList<string> get_uris () {
@@ -67,7 +67,8 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
this.extractor = new MetadataExtractor ();
- this.harvester = new ArrayList<MediaExportHarvester> ();
+ this.harvester = new HashMap<File,MediaExportHarvester> (file_hash,
+ file_equal);
this.monitor = new MediaExportRecursiveFileMonitor (null);
this.monitor.changed.connect (this.on_file_changed);
@@ -94,16 +95,19 @@ public class Rygel.MediaExportRootContainer : Rygel.MediaDBContainer {
this.media_db.delete_by_id (id);
}
this.updated ();
+ }
-
- }
+ private void on_file_harvested (File file) {
+ this.harvester.remove (file);
+ }
private void harvest (File file, MediaContainer parent = this) {
var harvest = new MediaExportHarvester (parent,
this.media_db,
this.extractor,
this.monitor);
- this.harvester.add (harvest);
+ harvest.harvested.connect (this.on_file_harvested);
+ this.harvester[file] = harvest;
harvest.harvest (file);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]