[rygel/wip/create-reference: 9/11] WIP
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/create-reference: 9/11] WIP
- Date: Wed, 6 Mar 2013 16:20:29 +0000 (UTC)
commit 2d3a9a80cbe75f87a6a47cc3395ebc82bc3f0877
Author: Jens Georg <jensg openismus com>
Date: Mon Mar 4 18:08:16 2013 +0100
WIP
.../rygel-media-export-playlist-container.vala | 82 ++++++++++++++++++++
1 files changed, 82 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-playlist-container.vala
b/src/plugins/media-export/rygel-media-export-playlist-container.vala
new file mode 100644
index 0000000..787dce0
--- /dev/null
+++ b/src/plugins/media-export/rygel-media-export-playlist-container.vala
@@ -0,0 +1,82 @@
+using Gee;
+
+internal class Rygel.MediaExport.PlaylistContainer : DBContainer,
+ Rygel.WritableContainer {
+ public ArrayList<string> create_classes { get; set; }
+
+ public PlaylistContainer (string id, string title) {
+ Object (id : id,
+ title : title,
+ parent : null,
+ child_count : 0);
+ }
+
+ public override void constructed () {
+ base.constructed ();
+
+ this.upnp_class = Rygel.MediaContainer.PLAYLIST;
+ this.create_classes = new ArrayList<string> ();
+ // Only items, no folders
+ this.create_classes.add (Rygel.ImageItem.UPNP_CLASS);
+ this.create_classes.add (Rygel.PhotoItem.UPNP_CLASS);
+ this.create_classes.add (Rygel.VideoItem.UPNP_CLASS);
+ this.create_classes.add (Rygel.AudioItem.UPNP_CLASS);
+ this.create_classes.add (Rygel.MusicItem.UPNP_CLASS);
+
+ // Need to add an URI otherwise core doesn't mark the container as
+ // writable
+ this.uris.add ("rygel-writable://playlist-container");
+ }
+
+ public async string add_reference (Rygel.MediaObject object,
+ Cancellable? cancellable)
+ throws Error {
+ if (object is MediaContainer) {
+ throw new WriteableContainerError.NOT_IMPLEMENTED
+ ("Cannot create references to containers");
+ }
+
+ object.parent = this;
+ object.ref_id = object.id;
+ object.id = UUID.get ();
+
+ var cache = MediaCache.get_default ();
+ cache.save_item (object as MediaItem);
+
+ return object.id;
+ }
+
+
+ public async void add_item (Rygel.MediaItem item,
+ Cancellable? cancellable)
+ throws Error {
+ // FIXME: Add translation
+ throw new WriteableContainerError.NOT_IMPLEMENTED
+ ("Can't create items here");
+ }
+
+ public async void remove_item (string id,
+ Cancellable? cancellable)
+ throws Error {
+ // FIXME: Add translation
+ throw new WriteableContainerError.NOT_IMPLEMENTED
+ ("Can't create items here");
+ }
+
+ public async void add_container (Rygel.MediaContainer container,
+ Cancellable? cancellable)
+ throws Error {
+ // FIXME: Add translation
+ throw new WriteableContainerError.NOT_IMPLEMENTED
+ ("upnp:class not supported");
+ }
+
+ public async void remove_container (string id,
+ Cancellable? cancellable)
+ throws Error {
+ // FIXME: Add translation
+ throw new WriteableContainerError.NOT_IMPLEMENTED
+ ("Can't create items here");
+ }
+
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]