[rygel] media-export: Fix DIDL_S playlist extraction



commit 247aec965f83cbbba67199bd84851a735e62ed74
Author: Jens Georg <mail jensge org>
Date:   Wed Sep 9 16:37:01 2015 +0200

    media-export: Fix DIDL_S playlist extraction
    
    Signed-off-by: Jens Georg <mail jensge org>

 .../media-export/rygel-media-export-extract.vala   |    3 +-
 .../rygel-media-export-item-factory.vala           |   33 ++------------------
 2 files changed, 5 insertions(+), 31 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-extract.vala 
b/src/plugins/media-export/rygel-media-export-extract.vala
index 984b039..2ff25da 100644
--- a/src/plugins/media-export/rygel-media-export-extract.vala
+++ b/src/plugins/media-export/rygel-media-export-extract.vala
@@ -101,7 +101,8 @@ async void run () {
                     GLib.Memory.copy (last_uri.data,
                                       (void *) parts[0],
                                       parts[0].length);
-                    var is_text = parts[1].has_prefix ("text/");
+                    var is_text = parts[1].has_prefix ("text/") ||
+                                  parts[1].has_suffix ("xml");
                     if (metadata && !is_text) {
                         info = discoverer.discover_uri (parts[0]);
 
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 e133309..3accbc3 100644
--- a/src/plugins/media-export/rygel-media-export-item-factory.vala
+++ b/src/plugins/media-export/rygel-media-export-item-factory.vala
@@ -33,36 +33,6 @@ using Gst.PbUtils;
  * Represents MediaExport item.
  */
 namespace Rygel.MediaExport.ItemFactory {
-    public static MediaFileItem? create_simple (MediaContainer parent,
-                                                File           file,
-                                                FileInfo       info) {
-        var title = info.get_display_name ();
-        MediaFileItem item;
-        var mime = ContentType.get_mime_type (info.get_content_type ());
-
-        if (mime.has_prefix ("video/")) {
-            item = new VideoItem (MediaCache.get_id (file), parent, title);
-        } else if (mime.has_prefix ("image/")) {
-            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
-            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";
-        }
-
-        item.mime_type = mime;
-        item.size = (int64) info.get_size ();
-        item.modified = info.get_attribute_uint64 (FileAttribute.TIME_MODIFIED);
-        item.add_uri (file.get_uri ());
-
-        return item;
-    }
-
     private static MediaFileItem? create_playlist_item (File file,
                                                         MediaContainer parent,
                                                         string fallback_title) {
@@ -186,6 +156,9 @@ namespace Rygel.MediaExport.ItemFactory {
             case Rygel.MusicItem.UPNP_CLASS:
                 item = new MusicItem (id, parent, "");
                 break;
+            case Rygel.PlaylistItem.UPNP_CLASS:
+                item = ItemFactory.create_playlist_item (file, parent, "");
+                break;
             default:
                 return null;
         }


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