diff options
author | Jens Georg <mail@jensge.org> | 2015-09-09 16:37:01 +0200 |
---|---|---|
committer | Jens Georg <mail@jensge.org> | 2015-09-09 16:37:01 +0200 |
commit | 247aec965f83cbbba67199bd84851a735e62ed74 (patch) | |
tree | 1fbaa20ae8e92627ba7657cc355169afac3dcc80 | |
parent | 513f9b34c69f3414af4a8dbbb2ea9f2274977c02 (diff) | |
download | rygel-247aec965f83cbbba67199bd84851a735e62ed74.tar.gz |
media-export: Fix DIDL_S playlist extraction
Signed-off-by: Jens Georg <mail@jensge.org>
-rw-r--r-- | src/plugins/media-export/rygel-media-export-extract.vala | 3 | ||||
-rw-r--r-- | src/plugins/media-export/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 984b039f..2ff25da5 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 e133309a..3accbc37 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; } |