From 525ba5866276679ca0e53c51f71c0f372e3cb28d Mon Sep 17 00:00:00 2001 From: Jens Georg Date: Thu, 22 Nov 2012 11:32:37 +0100 Subject: [PATCH] server: Add skeleton playlist handler --- src/librygel-server/filelist.am | 1 + src/librygel-server/rygel-http-get.vala | 4 +++ .../rygel-http-playlist-handler.vala | 39 ++++++++++++++++++++++ tests/rygel-http-get-test.vala | 4 +++ 4 files changed, 48 insertions(+) create mode 100644 src/librygel-server/rygel-http-playlist-handler.vala diff --git a/src/librygel-server/filelist.am b/src/librygel-server/filelist.am index 2080398..ce9158f 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 00a6a2a..4a8feb1 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-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 + * + * 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; + } +} diff --git a/tests/rygel-http-get-test.vala b/tests/rygel-http-get-test.vala index 3c93ceb..3eb9cda 100644 --- a/tests/rygel-http-get-test.vala +++ b/tests/rygel-http-get-test.vala @@ -373,6 +373,10 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPGetHandler { public HTTPIdentityHandler (Cancellable cancellable) {} } +internal class Rygel.HTTPPlaylistHandler : Rygel.HTTPGetHandler { + public HTTPPlaylistHandler (Cancellable cancellable) {} +} + public abstract class Rygel.MediaItem : Rygel.MediaObject { public long size = 1024; public ArrayList subtitles = new ArrayList (); -- 2.7.4