[rygel] core,tests: Shorter HTTP URLs



commit 7daa02dd2d267b17480c19d2f774f836eb1e62a1
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Dec 16 19:33:59 2010 +0200

    core,tests: Shorter HTTP URLs
    
    - Remove redundant 'RygelHTTPServer' prefix (plugin names are unique).
    - Abbreviate parameter names in URL.

 src/rygel/rygel-http-item-uri.vala  |   16 ++++++++--------
 src/rygel/rygel-http-server.vala    |    3 +--
 tests/rygel-http-item-uri-test.vala |    2 +-
 3 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/src/rygel/rygel-http-item-uri.vala b/src/rygel/rygel-http-item-uri.vala
index 4b0a66f..b72884c 100644
--- a/src/rygel/rygel-http-item-uri.vala
+++ b/src/rygel/rygel-http-item-uri.vala
@@ -61,22 +61,22 @@ internal class Rygel.HTTPItemURI : Object {
 
         for (int i = 1; i < parts.length - 1; i += 2) {
             switch (parts[i]) {
-                case "item":
+                case "i":
                     var data = Base64.decode (Soup.URI.decode (parts[i + 1]));
                     StringBuilder builder = new StringBuilder ();
                     builder.append ((string) data);
                     this.item_id = builder.str;
 
                     break;
-                case "transcoded":
+                case "tr":
                     this.transcode_target = Soup.URI.decode (parts[i + 1]);
 
                     break;
-                case "thumbnail":
+                case "th":
                     this.thumbnail_index = parts[i + 1].to_int ();
 
                     break;
-                case "subtitle":
+                case "sub":
                     this.subtitle_index = parts[i + 1].to_int ();
 
                     break;
@@ -98,15 +98,15 @@ internal class Rygel.HTTPItemURI : Object {
         var escaped = Uri.escape_string (Base64.encode ((uchar[]) data),
                                          "",
                                          true);
-        string path = "/item/" + escaped;
+        string path = "/i/" + escaped;
 
         if (this.transcode_target != null) {
             escaped = Uri.escape_string (this.transcode_target, "", true);
-            path += "/transcoded/" + escaped;
+            path += "/tr/" + escaped;
         } else if (this.thumbnail_index >= 0) {
-            path += "/thumbnail/" + this.thumbnail_index.to_string ();
+            path += "/th/" + this.thumbnail_index.to_string ();
         } else if (this.subtitle_index >= 0) {
-            path += "/subtitle/" + this.subtitle_index.to_string ();
+            path += "/sub/" + this.subtitle_index.to_string ();
         }
 
         return this.create_uri_for_path (path);
diff --git a/src/rygel/rygel-http-server.vala b/src/rygel/rygel-http-server.vala
index 84d452a..1b49b5f 100644
--- a/src/rygel/rygel-http-server.vala
+++ b/src/rygel/rygel-http-server.vala
@@ -26,7 +26,6 @@ using GUPnP;
 using Gee;
 
 internal class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
-    private const string SERVER_PATH_PREFIX = "/RygelHTTPServer";
     public string path_root { get; private set; }
 
     // Reference to root container of associated ContentDirectory
@@ -45,7 +44,7 @@ internal class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
         this.requests = new ArrayList<HTTPRequest> ();
         this.cancellable = content_dir.cancellable;
 
-        this.path_root = SERVER_PATH_PREFIX + "/" + name;
+        this.path_root = "/" + name;
     }
 
     public async void run () {
diff --git a/tests/rygel-http-item-uri-test.vala b/tests/rygel-http-item-uri-test.vala
index 8f3442d..c739c79 100644
--- a/tests/rygel-http-item-uri-test.vala
+++ b/tests/rygel-http-item-uri-test.vala
@@ -32,7 +32,7 @@ private errordomain Rygel.TestError {
 }
 
 private class Rygel.HTTPServer : GLib.Object {
-    private const string SERVER_PATH = "/RygelHTTPServer/Rygel/Test";
+    private const string SERVER_PATH = "/Test";
 
     public string path_root { get; private set; }
 



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