[rygel] media-export: Use metadata extractor only in harvesting task.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] media-export: Use metadata extractor only in harvesting task.
- Date: Mon, 4 Mar 2013 14:16:20 +0000 (UTC)
commit f3fd0192f7ea8775623cc877b114937b73526a40
Author: Krzesimir Nowak <krnowak openismus com>
Date: Mon Mar 4 15:15:14 2013 +0100
media-export: Use metadata extractor only in harvesting task.
Harvester also kept an extractor, but it wasn't used for anything.
.../media-export/rygel-media-export-harvester.vala | 11 +---------
.../rygel-media-export-harvesting-task.vala | 21 ++-----------------
2 files changed, 4 insertions(+), 28 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-harvester.vala
b/src/plugins/media-export/rygel-media-export-harvester.vala
index 7732dc6..153f1d2 100644
--- a/src/plugins/media-export/rygel-media-export-harvester.vala
+++ b/src/plugins/media-export/rygel-media-export-harvester.vala
@@ -28,7 +28,6 @@ internal class Rygel.MediaExport.Harvester : GLib.Object {
private HashMap<File, HarvestingTask> tasks;
private HashMap<File, uint> extraction_grace_timers;
- private MetadataExtractor extractor;
private RecursiveFileMonitor monitor;
private Cancellable cancellable;
@@ -50,8 +49,6 @@ internal class Rygel.MediaExport.Harvester : GLib.Object {
}
}
- this.extractor = new MetadataExtractor ();
-
this.monitor = new RecursiveFileMonitor (cancellable);
this.monitor.changed.connect (this.on_file_changed);
@@ -90,17 +87,11 @@ internal class Rygel.MediaExport.Harvester : GLib.Object {
MediaContainer parent,
string? flag = null) {
this.extraction_grace_timers.unset (file);
- if (this.extractor == null) {
- warning (_("No metadata extractor available. Will not crawl."));
-
- return;
- }
// Cancel a probably running harvester
this.cancel (file);
- var task = new HarvestingTask (new MetadataExtractor (),
- this.monitor,
+ var task = new HarvestingTask (this.monitor,
file,
parent,
flag);
diff --git a/src/plugins/media-export/rygel-media-export-harvesting-task.vala
b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
index c0da9f8..277c3e5 100644
--- a/src/plugins/media-export/rygel-media-export-harvesting-task.vala
+++ b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
@@ -56,12 +56,11 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
FileAttribute.STANDARD_SIZE + "," +
FileAttribute.STANDARD_IS_HIDDEN;
- public HarvestingTask (MetadataExtractor extractor,
- RecursiveFileMonitor monitor,
+ public HarvestingTask (RecursiveFileMonitor monitor,
File file,
MediaContainer parent,
string? flag = null) {
- this.extractor = extractor;
+ this.extractor = new MetadataExtractor ();
this.origin = file;
this.parent = parent;
this.cache = MediaCache.get_default ();
@@ -298,13 +297,6 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
this.completed ();
}
- var entry = this.files.peek ();
- if (entry == null || !file.equal (entry.file)) {
- // this event may be triggered by another instance
- // just ignore it
- return;
- }
-
MediaItem item;
if (dlna == null) {
item = ItemFactory.create_simple (this.containers.peek_head (),
@@ -322,7 +314,7 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
item.parent_ref = this.containers.peek_head ();
// This is only necessary to generate the proper <objAdd LastChange
// entry
- if (entry.known) {
+ if (this.files.peek ().known) {
(item as UpdatableObject).non_overriding_commit.begin ();
} else {
var container = item.parent as TrackableContainer;
@@ -335,13 +327,6 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
}
private void on_extractor_error_cb (File file, Error error) {
- var entry = this.files.peek ();
- if (entry == null || !file.equal (entry.file)) {
- // this event may be triggered by another instance
- // just ignore it
- return;
- }
-
// error is only emitted if even the basic information extraction
// failed; there's not much to do here, just print the information and
// go to the next file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]