[rygel] core: Map special folders of XBox360 to root folder



commit c01b55cb86390a6357944eeba593881737460364
Author: Jens Georg <mail jensge org>
Date:   Mon Mar 8 09:57:18 2010 +0100

    core: Map special folders of XBox360 to root folder

 src/rygel/rygel-browse.vala |    6 ++++++
 src/rygel/rygel-search.vala |   12 ++++++++++++
 2 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-browse.vala b/src/rygel/rygel-browse.vala
index d5ef0e3..496f196 100644
--- a/src/rygel/rygel-browse.vala
+++ b/src/rygel/rygel-browse.vala
@@ -117,6 +117,12 @@ internal class Rygel.Browse: GLib.Object, Rygel.StateMachine {
             this.action.get ("ContainerID",
                              typeof (string),
                              out this.object_id);
+            // Map some special browse requests to browse on the root folder
+            if (this.object_id == "15" ||
+                this.object_id == "14" ||
+                this.object_id == "16") {
+                this.object_id = "0";
+            }
         }
 
         if (this.object_id == null) {
diff --git a/src/rygel/rygel-search.vala b/src/rygel/rygel-search.vala
index 1838f94..4c6c366 100644
--- a/src/rygel/rygel-search.vala
+++ b/src/rygel/rygel-search.vala
@@ -90,6 +90,18 @@ internal class Rygel.Search: GLib.Object, Rygel.StateMachine {
 
             debug ("Executing search request: %s", this.search_criteria);
 
+            // do magic translation for XBox
+            string agent = this.action.get_message ().request_headers.get ("User-Agent");
+            if (agent.has_prefix ("Xbox/")) {
+                if (container_id == "1" ||
+                    container_id == "4" ||
+                    container_id == "5" ||
+                    container_id == "6" ||
+                    container_id == "7") {
+                    container_id = "0";
+                }
+            }
+
             var container = yield this.fetch_container ();
             var results = yield this.fetch_results (container);
 



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