[rygel/wip/create-reference: 8/11] WIP



commit 1b3e3177ac641490452ddb62b30d08fff36781f3
Author: Jens Georg <jensg openismus com>
Date:   Mon Mar 4 18:07:54 2013 +0100

    WIP

 .../rygel-media-export-object-factory.vala         |    4 ++++
 ...rygel-media-export-playlist-root-container.vala |   19 +++++--------------
 2 files changed, 9 insertions(+), 14 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-object-factory.vala 
b/src/plugins/media-export/rygel-media-export-object-factory.vala
index fb9cbf9..fd251d7 100644
--- a/src/plugins/media-export/rygel-media-export-object-factory.vala
+++ b/src/plugins/media-export/rygel-media-export-object-factory.vala
@@ -65,6 +65,10 @@ internal class Rygel.MediaExport.ObjectFactory : Object {
             return new TrackableDbContainer (id, title);
         }
 
+        if (id.has_prefix ("playlist:")) {
+            return new PlaylistContainer (id, title);
+        }
+
         // Return a writable container for anything with a URI,
         // such as child folders of the file system,
         // to allow uploads.
diff --git a/src/plugins/media-export/rygel-media-export-playlist-root-container.vala 
b/src/plugins/media-export/rygel-media-export-playlist-root-container.vala
index 4479290..19e8acd 100644
--- a/src/plugins/media-export/rygel-media-export-playlist-root-container.vala
+++ b/src/plugins/media-export/rygel-media-export-playlist-root-container.vala
@@ -40,25 +40,16 @@ internal class Rygel.MediaExport.PlaylistRootContainer : Rygel.WritableContainer
     }
 
     public async void add_container (Rygel.MediaContainer container,
-                                              Cancellable?         cancellable)
-                                              throws Error {
+                                     Cancellable?         cancellable)
+                                     throws Error {
         if (container.upnp_class != Rygel.MediaContainer.PLAYLIST) {
-            warning ("===========> Foo! %s %s", container.upnp_class,
-                     Rygel.MediaContainer.PLAYLIST);
             throw new WriteableContainerError.NOT_IMPLEMENTED
                                         ("upnp:class not supported");
         }
+        container.id = "playlist:" + UUID.get ();
 
-        // FIXME: Do something here :)
-        assert_not_reached ();
-    }
-
-    public async string add_reference (Rygel.MediaObject object,
-                                       Cancellable?      cancellable)
-                                       throws Error {
-        warning ("===========================> add reference called");
-
-        return "";
+        var cache = MediaCache.get_default ();
+        cache.save_container (container);
     }
 
     public async void remove_container (string id,


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