[rygel/wip/playlist-item: 26/27] server: Add playlist item.



commit 1e15fe4fac9f889a895c100d1ad77cdaae76b2f2
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Fri Nov 23 17:56:43 2012 +0100

    server: Add playlist item.

 src/librygel-server/filelist.am              |    3 +-
 src/librygel-server/rygel-item-creator.vala  |    2 +
 src/librygel-server/rygel-playlist-item.vala |   41 ++++++++++++++++++++++++++
 tests/rygel-item-creator-test.vala           |    9 ++++++
 4 files changed, 54 insertions(+), 1 deletions(-)
---
diff --git a/src/librygel-server/filelist.am b/src/librygel-server/filelist.am
index ce9158f..bca9cac 100644
--- a/src/librygel-server/filelist.am
+++ b/src/librygel-server/filelist.am
@@ -28,7 +28,8 @@ LIBRYGEL_SERVER_VAPI_SOURCE_FILES = \
 	rygel-media-engine.vala \
 	rygel-http-seek.vala \
 	rygel-data-source.vala \
-	rygel-updatable-object.vala
+	rygel-updatable-object.vala \
+	rygel-playlist-item.vala
 
 LIBRYGEL_SERVER_NONVAPI_SOURCE_FILES = \
 	rygel-browse.vala \
diff --git a/src/librygel-server/rygel-item-creator.vala b/src/librygel-server/rygel-item-creator.vala
index 45f2952..5b6750d 100644
--- a/src/librygel-server/rygel-item-creator.vala
+++ b/src/librygel-server/rygel-item-creator.vala
@@ -447,6 +447,8 @@ internal class Rygel.ItemCreator: GLib.Object, Rygel.StateMachine {
             return new AudioItem (id, parent, title);
         case MusicItem.UPNP_CLASS:
             return new MusicItem (id, parent, title);
+        case PlaylistItem.UPNP_CLASS:
+            return new PlaylistItem (id, parent, title);
         default:
             throw new ContentDirectoryError.BAD_METADATA
                                         ("Creation of item of class '%s' " +
diff --git a/src/librygel-server/rygel-playlist-item.vala b/src/librygel-server/rygel-playlist-item.vala
new file mode 100644
index 0000000..ff4ad8c
--- /dev/null
+++ b/src/librygel-server/rygel-playlist-item.vala
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2012 Intel Corporation.
+ *
+ * Author: Krzesimir Nowak <krnowak 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.
+ */
+
+/**
+ * Represents a playlist item.
+ *
+ * These objects correspond to DLNA's DIDL_S items.
+ */
+public class Rygel.PlaylistItem : MediaItem {
+    public new const string UPNP_CLASS = "object.item.playlistItem";
+
+    public PlaylistItem (string         id,
+                         MediaContainer parent,
+                         string         title,
+                         string         upnp_class = PlaylistItem.UPNP_CLASS) {
+        base (id, parent, title, upnp_class);
+    }
+
+    public override bool streamable () {
+        return false;
+    }
+}
diff --git a/tests/rygel-item-creator-test.vala b/tests/rygel-item-creator-test.vala
index 237dc20..f93aa1a 100644
--- a/tests/rygel-item-creator-test.vala
+++ b/tests/rygel-item-creator-test.vala
@@ -183,6 +183,15 @@ public class Rygel.PhotoItem : Rygel.MediaItem {
         base (id, parent, title);
     }
 }
+
+public class Rygel.PlaylistItem : Rygel.MediaItem {
+    public const string UPNP_CLASS = "object.item.playlistItem";
+
+    public PlaylistItem (string id, MediaContainer parent, string title) {
+        base (id, parent, title);
+    }
+}
+
 public class Rygel.ContentDirectory : GLib.Object {
     public Cancellable cancellable;
     public MediaContainer root_container;



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