core: Provide 'importUri' for all items
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Tue, 26 Jan 2010 15:00:57 +0000 (17:00 +0200)
committerZeeshan Ali (Khattak) <zeeshanak@gnome.org>
Wed, 3 Feb 2010 13:38:48 +0000 (15:38 +0200)
src/rygel/rygel-http-server.vala
src/rygel/rygel-media-item.vala

index c4be370..33ad342 100644 (file)
@@ -66,9 +66,7 @@ internal class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
                                           MediaItem    item)
                                           throws Error {
         if (!this.http_uri_present (item)) {
-            // Create the HTTP proxy URI
-            var uri = this.create_uri_for_item (item, -1, null);
-            item.add_resource (didl_item, uri, this.get_protocol ());
+            this.add_proxy_resource (didl_item, item);
         }
 
         base.add_resources (didl_item, item);
@@ -88,6 +86,17 @@ internal class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
         }
     }
 
+    internal void add_proxy_resource (DIDLLiteItem didl_item,
+                                      MediaItem    item)
+                                      throws Error {
+        var uri = this.create_uri_for_item (item, -1, null);
+
+        item.add_resource (didl_item,
+                           uri.to_string (),
+                           this.get_protocol (),
+                           uri.to_string ());
+    }
+
     private bool http_uri_present (MediaItem item) {
         bool present = false;
 
index adbbb7b..337eb9f 100644 (file)
@@ -156,7 +156,8 @@ public class Rygel.MediaItem : MediaObject {
 
     internal DIDLLiteResource add_resource (DIDLLiteItem didl_item,
                                             string?      uri,
-                                            string       protocol)
+                                            string       protocol,
+                                            string?      import_uri = null)
                                             throws Error {
         var res = didl_item.add_resource ();
 
@@ -164,6 +165,10 @@ public class Rygel.MediaItem : MediaObject {
             res.uri = uri;
         }
 
+        if (import_uri != null) {
+            res.import_uri = import_uri;
+        }
+
         res.size = this.size;
         res.duration = this.duration;
         res.bitrate = this.bitrate;