[rygel] media-export: Don't run gupnp-dlna on text/*



commit f5eef35247f6110529130b40ad06e80d33a0e95c
Author: Jens Georg <jensg openismus com>
Date:   Thu Dec 13 12:48:00 2012 +0100

    media-export: Don't run gupnp-dlna on text/*
    
    This should speed up extraction again as it doesn't run into a timeout all
    the time with lots of text files.

 .../rygel-media-export-harvesting-task.vala        |   17 +++++++++++++----
 .../rygel-media-export-metadata-extractor.vala     |    4 ++--
 2 files changed, 15 insertions(+), 6 deletions(-)
---
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 e487a49..336802d 100644
--- a/src/plugins/media-export/rygel-media-export-harvesting-task.vala
+++ b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
@@ -24,10 +24,12 @@ using Gee;
 internal class FileQueueEntry {
     public File file;
     public bool known;
+    public string content_type;
 
-    public FileQueueEntry (File file, bool known) {
+    public FileQueueEntry (File file, bool known, string content_type) {
         this.file = file;
         this.known = known;
+        this.content_type = content_type;
     }
 }
 
@@ -153,12 +155,18 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
 
                 if (mtime > timestamp ||
                     info.get_size () != size) {
-                    this.files.offer (new FileQueueEntry (file, true));
+                    var entry = new FileQueueEntry (file,
+                                                    true,
+                                                    info.get_content_type ());
+                    this.files.offer (entry);
 
                     return true;
                 }
             } else {
-                this.files.offer (new FileQueueEntry (file, false));
+                var entry = new FileQueueEntry (file,
+                                                true,
+                                                info.get_content_type ());
+                this.files.offer (entry);
 
                 return true;
             }
@@ -269,7 +277,8 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
         if (this.files.size > 0) {
             debug ("Scheduling file %s for meta-data extractionâ",
                    this.files.peek ().file.get_uri ());
-            this.extractor.extract (this.files.peek ().file);
+            this.extractor.extract (this.files.peek ().file,
+                                    this.files.peek ().content_type);
         } else if (this.containers.get_length () > 0) {
             this.enumerate_directory.begin ();
         } else {
diff --git a/src/plugins/media-export/rygel-media-export-metadata-extractor.vala b/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
index 1c61997..bf2967b 100644
--- a/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
+++ b/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
@@ -72,8 +72,8 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
         }
     }
 
-    public void extract (File file) {
-        if (this.extract_metadata) {
+    public void extract (File file, string content_type) {
+        if (this.extract_metadata && !content_type.has_prefix ("text/")) {
             string uri = file.get_uri ();
             this.file_hash.set (uri, file);
             var gst_timeout = (ClockTime) (this.timeout * Gst.SECOND);



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