[rygel] media-export: Apply file filter in monitoring



commit 8715db959eaa7f9f03fc3e3d2c44d2b844de0484
Author: Jens Georg <mail jensge org>
Date:   Sat Aug 28 07:21:19 2010 +0300

    media-export: Apply file filter in monitoring
    
    The inclusion filter was not used for file monitoring

 .../media-export/rygel-media-export-harvester.vala |   29 +++++++++++---------
 1 files changed, 16 insertions(+), 13 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala b/src/plugins/media-export/rygel-media-export-harvester.vala
index 243e6b2..4fb264c 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -139,20 +139,23 @@ internal class Rygel.MediaExport.Harvester : GLib.Object {
             switch (event) {
                 case FileMonitorEvent.CREATED:
                 case FileMonitorEvent.CHANGES_DONE_HINT:
-                    debug (_("Trying to harvest %s because of %d"),
-                           file.get_uri (),
-                           event);
-                    var id = MediaCache.get_id (file.get_parent ());
-                    try {
-                        var parent_container = cache.get_object (id)
+                    if (this.file_filter == null ||
+                        this.file_filter.match (file.get_uri ())) {
+                        debug (_("Trying to harvest %s because of %d"),
+                               file.get_uri (),
+                               event);
+                        var id = MediaCache.get_id (file.get_parent ());
+                        try {
+                               var parent_container = cache.get_object (id)
                                             as MediaContainer;
-                        assert (parent_container != null);
+                                assert (parent_container != null);
 
-                        this.schedule (file, parent_container);
-                    } catch (DatabaseError error) {
-                        warning (_("Error fetching object '%s' from database: %s"),
-                                 id,
-                                 error.message);
+                                this.schedule (file, parent_container);
+                        } catch (DatabaseError error) {
+                            warning (_("Error fetching object '%s' from database: %s"),
+                                     id,
+                                     error.message);
+                        }
                     }
                     break;
                 case FileMonitorEvent.DELETED:



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