[rygel/wip/didl-s: 2/2] WIP



commit 233e1cce877ae3111e839e953a573f230fab3c3b
Author: Jens Georg <jensg openismus com>
Date:   Thu Nov 1 12:32:16 2012 +0100

    WIP

 src/librygel-server/filelist.am                    |    1 +
 src/librygel-server/rygel-http-get.vala            |    4 ++
 src/librygel-server/rygel-http-item-uri.vala       |   14 +++++++-
 .../rygel-http-playlist-handler.vala               |   39 ++++++++++++++++++++
 4 files changed, 57 insertions(+), 1 deletions(-)
---
diff --git a/src/librygel-server/filelist.am b/src/librygel-server/filelist.am
index d43e800..fbf4522 100644
--- a/src/librygel-server/filelist.am
+++ b/src/librygel-server/filelist.am
@@ -40,6 +40,7 @@ LIBRYGEL_SERVER_NONVAPI_SOURCE_FILES = \
 	rygel-http-get-handler.vala \
 	rygel-http-get.vala \
 	rygel-http-identity-handler.vala \
+	rygel-http-playlist-handler.vala \
 	rygel-http-item-uri.vala \
 	rygel-http-post.vala \
 	rygel-http-request.vala \
diff --git a/src/librygel-server/rygel-http-get.vala b/src/librygel-server/rygel-http-get.vala
index a6ea908..e93edf2 100644
--- a/src/librygel-server/rygel-http-get.vala
+++ b/src/librygel-server/rygel-http-get.vala
@@ -66,6 +66,10 @@ internal class Rygel.HTTPGet : HTTPRequest {
                                                      this.cancellable);
         }
 
+        if (uri.playlist_format != null) {
+            this.handler = new HTTPPlaylistHandler (this.cancellable);
+        }
+
         if (this.handler == null) {
             this.handler = new HTTPIdentityHandler (this.cancellable);
         }
diff --git a/src/librygel-server/rygel-http-item-uri.vala b/src/librygel-server/rygel-http-item-uri.vala
index d20aa83..325aa26 100644
--- a/src/librygel-server/rygel-http-item-uri.vala
+++ b/src/librygel-server/rygel-http-item-uri.vala
@@ -30,6 +30,7 @@ internal class Rygel.HTTPItemURI : Object {
     public int thumbnail_index;
     public int subtitle_index;
     public string? transcode_target;
+    public string? playlist_format;
     public unowned HTTPServer http_server;
     private string real_extension;
     public string extension {
@@ -50,12 +51,14 @@ internal class Rygel.HTTPItemURI : Object {
                         HTTPServer http_server,
                         int        thumbnail_index = -1,
                         int        subtitle_index = -1,
-                        string?    transcode_target = null) {
+                        string?    transcode_target = null,
+                        string?    playlist_format = null) {
         this.item_id = item.id;
         this.thumbnail_index = thumbnail_index;
         this.subtitle_index = subtitle_index;
         this.transcode_target = transcode_target;
         this.http_server = http_server;
+        this.playlist_format = null;
         this.extension = "";
 
         if (thumbnail_index > -1) {
@@ -157,6 +160,9 @@ internal class Rygel.HTTPItemURI : Object {
                     this.subtitle_index = int.parse (parts[i + 1]);
 
                     break;
+                case "pl":
+                    this.playlist_format = Soup.URI.decode (parts[i + 1]);
+                    break;
                 default:
                     break;
             }
@@ -184,6 +190,9 @@ internal class Rygel.HTTPItemURI : Object {
             path += "/th/" + this.thumbnail_index.to_string ();
         } else if (this.subtitle_index >= 0) {
             path += "/sub/" + this.subtitle_index.to_string ();
+        } else if (this.playlist_format != null) {
+            path += "/pl/" +
+                    Uri.escape_string (this.playlist_format, "", true);
         }
         path += this.extension;
         return this.create_uri_for_path (path);
@@ -220,6 +229,9 @@ internal class Rygel.HTTPItemURI : Object {
 
             // texts
             mime_to_ext.set ("text/srt", "srt");
+            mime_to_ext.set ("text/xml", "xml");
+            mime_to_ext.set ("audio/x-mpegurl", "m3u");
+            mime_to_ext.set ("audio/m3u", "m3u");
 
             // applications? (can be either video or audio?);
             mime_to_ext.set ("application/ogg", "ogg");
diff --git a/src/librygel-server/rygel-http-playlist-handler.vala b/src/librygel-server/rygel-http-playlist-handler.vala
new file mode 100644
index 0000000..915d143
--- /dev/null
+++ b/src/librygel-server/rygel-http-playlist-handler.vala
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2012 Intel Corporation.
+ *
+ * Author: Jens Georg <jensg openismus com>
+ *
+ * This file is part of Rygel.
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+using GUPnP;
+
+internal class Rygel.HTTPPlaylistHandler : Rygel.HTTPGetHandler {
+    public HTTPPlaylistHandler (Cancellable? cancellable) {
+        this.cancellable = cancellable;
+    }
+
+    public override HTTPResponse render_body (HTTPGet request)
+                                              throws HTTPRequestError {
+        throw new HTTPRequestError.NOT_FOUND ("Not implemented yet");
+    }
+
+    protected override DIDLLiteResource add_resource (DIDLLiteItem didl_item,
+                                                      HTTPGet      request) {
+        // TODO: Implement
+        return null as DIDLLiteResource;
+    }
+}



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