[rygel/wip/dvd: 21/21] media-export: Continue harvesting



commit 6b80cf9d8c643eacd739c08f798b638da9e9c8bd
Author: Jens Georg <jensg openismus com>
Date:   Sun Jul 21 14:26:31 2013 +0200

    media-export: Continue harvesting

 .../rygel-media-export-dvd-parser.vala             |    2 +-
 .../rygel-media-export-item-factory.vala           |   11 +++++++++--
 .../rygel-media-export-metadata-extractor.vala     |    6 +++++-
 3 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-dvd-parser.vala 
b/src/plugins/media-export/rygel-media-export-dvd-parser.vala
index b4a4fef..19e9993 100644
--- a/src/plugins/media-export/rygel-media-export-dvd-parser.vala
+++ b/src/plugins/media-export/rygel-media-export-dvd-parser.vala
@@ -22,7 +22,7 @@
 
 internal class Rygel.MediaExport.DVDParser : GLib.Object {
     /// URI to the image / toplevel directory
-    public File file { private get; construct; }
+    public File file { public get; construct; }
 
     private File cache_file;
 
diff --git a/src/plugins/media-export/rygel-media-export-item-factory.vala 
b/src/plugins/media-export/rygel-media-export-item-factory.vala
index 84c0717..35b98e8 100644
--- a/src/plugins/media-export/rygel-media-export-item-factory.vala
+++ b/src/plugins/media-export/rygel-media-export-item-factory.vala
@@ -35,7 +35,7 @@ namespace Rygel.MediaExport.ItemFactory {
                                             File           file,
                                             FileInfo       info) {
         var title = info.get_display_name ();
-        MediaItem item;
+        MediaItem item = null;
         var mime = ContentType.get_mime_type (info.get_content_type ());
 
         if (mime.has_prefix ("video/")) {
@@ -44,13 +44,20 @@ namespace Rygel.MediaExport.ItemFactory {
             item = new PhotoItem (MediaCache.get_id (file), parent, title);
         } else if (mime.has_prefix ("audio/") || mime == "application/ogg") {
             item = new MusicItem (MediaCache.get_id (file), parent, title);
-        } else { // application/xml or text/xml
+        } else if (mime.has_suffix ("/xml")) {
             item = ItemFactory.create_playlist_item (file, parent, title);
             if (item == null) {
                 return null;
             }
             // DLNA requires that DIDL_S playlist have text/xml MIME type.
             mime = "text/xml";
+        } else if (mime == "application/x-cd-image") {
+            // The code analysing the file should already have checked that
+            // this really is a DVD and not some live CD or so.
+            //item = ItemFactory.create_dvd_item (file, parent, title);
+            return null;
+        } else {
+            return null;
         }
 
         item.mime_type = mime;
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 41a5742..db2052a 100644
--- a/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
+++ b/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
@@ -78,7 +78,7 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
 
         if (content_type == "application/x-cd-image") {
             this.dvd_parser = new DVDParser (file);
-            this.dvd_parser.run.begin ();
+            this.dvd_parser.run.begin (this.on_dvd_parser_done);
 
             return;
         }
@@ -131,6 +131,10 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
         this.extract_basic_information (file, info, dlna);
     }
 
+    private void on_dvd_parser_done () {
+        this.extract_basic_information (this.dvd_parser.file, null, null);
+    }
+
     private void extract_basic_information (File               file,
                                             DiscovererInfo?    info,
                                             GUPnPDLNA.Profile? dlna) {


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