private Regex file_filter;
private Cancellable cancellable;
+ // Properties
+ public ArrayList<File> locations { get; private set; }
+
public signal void done ();
/**
* Create a new instance of the meta-data extraction manager.
*/
- public Harvester (Cancellable cancellable) {
+ public Harvester (Cancellable cancellable,
+ ArrayList<File> locations) {
this.cancellable = cancellable;
+ this.locations = new ArrayList<File> ((EqualFunc) File.equal);
+ foreach (var file in locations) {
+ if (file.query_exists ()) {
+ this.locations.add (file);
+ }
+ }
+
this.extractor = new MetadataExtractor ();
this.monitor = new RecursiveFileMonitor (cancellable);
var parent = current.get_parent ();
id = MediaCache.get_id (parent);
parent_container = cache.get_object (id)
- as MediaContainer;
+ as MediaContainer;
+
if (parent_container == null) {
current = parent;
}
+
+ if (current in this.locations) {
+ // We have reached the top
+ parent_container = cache.get_object
+ (RootContainer.FILESYSTEM_FOLDER_ID)
+ as MediaContainer;
+
+ break;
+ }
} while (parent_container == null);
this.schedule (current, parent_container);
base (db, "0", _("@REALNAME@'s media"));
this.cancellable = new Cancellable ();
- this.harvester = new Harvester (this.cancellable);
try {
this.service = new DBusService (this);
ids = new ArrayList<string> ();
}
+ this.harvester = new Harvester (this.cancellable,
+ this.get_shared_uris ());
this.harvester_signal_id = this.harvester.done.connect
(on_initial_harvesting_done);
- foreach (var file in this.get_shared_uris ()) {
- if (file.query_exists (null)) {
- ids.remove (MediaCache.get_id (file));
- this.harvester.schedule (file,
- this.filesystem_container);
- }
+ foreach (var file in this.harvester.locations) {
+ ids.remove (MediaCache.get_id (file));
+ this.harvester.schedule (file,
+ this.filesystem_container);
}
foreach (var id in ids) {