rygel r153 - in trunk: . src/media-providers/tracker src/media-server



Author: zeeshanak
Date: Tue Oct 28 21:01:39 2008
New Revision: 153
URL: http://svn.gnome.org/viewvc/rygel?rev=153&view=rev

Log:
Start utilizing the MediaContainer class in media providers.

Modified:
   trunk/ChangeLog
   trunk/src/media-providers/tracker/gupnp-media-tracker.vala
   trunk/src/media-server/gupnp-media-manager.vala

Modified: trunk/src/media-providers/tracker/gupnp-media-tracker.vala
==============================================================================
--- trunk/src/media-providers/tracker/gupnp-media-tracker.vala	(original)
+++ trunk/src/media-providers/tracker/gupnp-media-tracker.vala	Tue Oct 28 21:01:39 2008
@@ -25,9 +25,7 @@
 using GUPnP;
 using DBus;
 
-private class Tracker.Container {
-    public string id;
-    public string parent_id;
+private class Tracker.Container : MediaContainer {
     public string title;
     public string tracker_category;
 
@@ -213,40 +211,10 @@
 
     private void add_container_from_db (DIDLLiteWriter    didl_writer,
                                         Tracker.Container container) {
-        uint child_count;
+        /* Update the child count */
+        container.child_count = get_container_children_count (container);
 
-        child_count = get_container_children_count (container);
-
-        this.add_container (didl_writer,
-                            container.id,
-                            container.parent_id,
-                            container.title,
-                            child_count);
-    }
-
-    private void add_container (DIDLLiteWriter didl_writer,
-                                string         id,
-                                string         parent_id,
-                                string         title,
-                                uint           child_count) {
-        didl_writer.start_container (id,
-                                     parent_id,
-                                     (int) child_count,
-                                     false,
-                                     false);
-
-        didl_writer.add_string ("class",
-                                DIDLLiteWriter.NAMESPACE_UPNP,
-                                null,
-                                "object.container.storageFolder");
-
-        didl_writer.add_string ("title",
-                                DIDLLiteWriter.NAMESPACE_DC,
-                                null,
-                                title);
-
-        /* End of Container */
-        didl_writer.end_container ();
+        container.serialize (didl_writer);
     }
 
     private uint get_container_children_count (Tracker.Container container) {
@@ -641,11 +609,11 @@
     }
 
     private void add_root_container (DIDLLiteWriter didl_writer) {
-        add_container (didl_writer,
-                       this.root_id,
-                       this.root_parent_id,
-                       this.title,
-                       this.containers.length ());
+        var container = new MediaContainer (this.root_id,
+                                            this.root_parent_id,
+                                            this.title,
+                                            this.containers.length ());
+        container.serialize (didl_writer);
     }
 
     private Tracker.Container? get_item_parent (string uri) {

Modified: trunk/src/media-server/gupnp-media-manager.vala
==============================================================================
--- trunk/src/media-server/gupnp-media-manager.vala	(original)
+++ trunk/src/media-server/gupnp-media-manager.vala	Tue Oct 28 21:01:39 2008
@@ -160,40 +160,15 @@
 
     private void add_root_container_metadata (DIDLLiteWriter didl_writer,
                                               out uint       update_id) {
-        add_container (didl_writer,
-                       this.root_id,
-                       "-1",         /* FIXME */
-                       this.title,
-                       this.providers.size ());
+        var container = new MediaContainer (this.root_id,
+                                            "-1",
+                                            this.title,
+                                            this.providers.size ());
+        container.serialize (didl_writer);
 
         update_id = this.system_update_id;
     }
 
-    private void add_container (DIDLLiteWriter didl_writer,
-                                string         id,
-                                string         parent_id,
-                                string         title,
-                                uint           child_count) {
-        didl_writer.start_container (id,
-                                     parent_id,
-                                     (int) child_count,
-                                     false,
-                                     false);
-
-        didl_writer.add_string ("class",
-                                DIDLLiteWriter.NAMESPACE_UPNP,
-                                null,
-                                "object.container.storageFolder");
-
-        didl_writer.add_string ("title",
-                                DIDLLiteWriter.NAMESPACE_DC,
-                                null,
-                                title);
-
-        /* End of Container */
-        didl_writer.end_container ();
-    }
-
     string get_root_id_from_id (string id) {
         string[] tokens;
 



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