[rygel] core: Move older XBox hacks to new relavent class



commit afc1bf39af0a29809f22543680e8ef9ac26e5fcc
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Mar 24 03:21:48 2010 +0200

    core: Move older XBox hacks to new relavent class

 src/rygel/rygel-search.vala     |   13 +++----------
 src/rygel/rygel-xbox-hacks.vala |   12 ++++++++++++
 2 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/src/rygel/rygel-search.vala b/src/rygel/rygel-search.vala
index 9ef99fd..220eb93 100644
--- a/src/rygel/rygel-search.vala
+++ b/src/rygel/rygel-search.vala
@@ -95,16 +95,9 @@ 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";
-                }
+            if (this.xbox_hacks != null) {
+                this.container_id = this.xbox_hacks.translate_container_id (
+                                        this.container_id);
             }
 
             var container = yield this.fetch_container ();
diff --git a/src/rygel/rygel-xbox-hacks.vala b/src/rygel/rygel-xbox-hacks.vala
index fe71a1b..6ec251b 100644
--- a/src/rygel/rygel-xbox-hacks.vala
+++ b/src/rygel/rygel-xbox-hacks.vala
@@ -34,6 +34,18 @@ internal class Rygel.XBoxHacks : GLib.Object {
         }
     }
 
+    public string translate_container_id (string container_id) {
+        if (container_id == "1" ||
+            container_id == "4" ||
+            container_id == "5" ||
+            container_id == "6" ||
+            container_id == "7") {
+            return "0";
+        } else {
+            return container_id;
+        }
+    }
+
     public void apply (MediaItem item) {
         if (item.mime_type == "video/x-msvideo") {
             item.mime_type = "video/avi";



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