JSONRPC: Migration of PicturePlayer
authormontellese <montellese@xbmc.org>
Mon, 7 Feb 2011 13:43:23 +0000 (14:43 +0100)
committermontellese <montellese@xbmc.org>
Fri, 1 Apr 2011 18:38:28 +0000 (20:38 +0200)
xbmc/interfaces/json-rpc/JSONRPC.cpp
xbmc/interfaces/json-rpc/PicturePlayerOperations.cpp
xbmc/interfaces/json-rpc/ServiceDescription.h

index 6c58c05..16afd1f 100644 (file)
@@ -98,20 +98,20 @@ JsonRpcMethodMap CJSONRPC::m_methodMaps[] = {
   { "VideoPlayer.SeekPercentage",                   CAVPlayerOperations::SeekPercentage },
 
 // Picture player
-//  { "PicturePlayer.PlayPause",                      CPicturePlayerOperations::PlayPause },
-//  { "PicturePlayer.Stop",                           CPicturePlayerOperations::Stop },
-//  { "PicturePlayer.SkipPrevious",                   CPicturePlayerOperations::SkipPrevious },
-//  { "PicturePlayer.SkipNext",                       CPicturePlayerOperations::SkipNext },
-//
-//  { "PicturePlayer.MoveLeft",                       CPicturePlayerOperations::MoveLeft },
-//  { "PicturePlayer.MoveRight",                      CPicturePlayerOperations::MoveRight },
-//  { "PicturePlayer.MoveDown",                       CPicturePlayerOperations::MoveDown },
-//  { "PicturePlayer.MoveUp",                         CPicturePlayerOperations::MoveUp },
-//
-//  { "PicturePlayer.ZoomOut",                        CPicturePlayerOperations::ZoomOut },
-//  { "PicturePlayer.ZoomIn",                         CPicturePlayerOperations::ZoomIn },
-//  { "PicturePlayer.Zoom",                           CPicturePlayerOperations::Zoom },
-//  { "PicturePlayer.Rotate",                         CPicturePlayerOperations::Rotate },
+  { "PicturePlayer.PlayPause",                      CPicturePlayerOperations::PlayPause },
+  { "PicturePlayer.Stop",                           CPicturePlayerOperations::Stop },
+  { "PicturePlayer.SkipPrevious",                   CPicturePlayerOperations::SkipPrevious },
+  { "PicturePlayer.SkipNext",                       CPicturePlayerOperations::SkipNext },
+
+  { "PicturePlayer.MoveLeft",                       CPicturePlayerOperations::MoveLeft },
+  { "PicturePlayer.MoveRight",                      CPicturePlayerOperations::MoveRight },
+  { "PicturePlayer.MoveDown",                       CPicturePlayerOperations::MoveDown },
+  { "PicturePlayer.MoveUp",                         CPicturePlayerOperations::MoveUp },
+
+  { "PicturePlayer.ZoomOut",                        CPicturePlayerOperations::ZoomOut },
+  { "PicturePlayer.ZoomIn",                         CPicturePlayerOperations::ZoomIn },
+  { "PicturePlayer.Zoom",                           CPicturePlayerOperations::Zoom },
+  { "PicturePlayer.Rotate",                         CPicturePlayerOperations::Rotate },
 
 // Video Playlist
   // TODO
index f2e2d12..7c00ede 100644 (file)
@@ -79,14 +79,7 @@ JSON_STATUS CPicturePlayerOperations::ZoomIn(const CStdString &method, ITranspor
 
 JSON_STATUS CPicturePlayerOperations::Zoom(const CStdString &method, ITransportLayer *transport, IClient *client, const Value &parameterObject, Value &result)
 {
-  if (!(parameterObject.isInt() || parameterObject.isNull()))
-    return InvalidParams;
-
-  int zoom = parameterObject.isInt() ? parameterObject.asInt() : 1;
-  if (zoom > 10 || zoom <= 0)
-    return InvalidParams;
-
-  return SendAction(ACTION_ZOOM_LEVEL_NORMAL + (zoom - 1));
+  return SendAction(ACTION_ZOOM_LEVEL_NORMAL + (parameterObject["value"].asInt() - 1));
 }
 
 JSON_STATUS CPicturePlayerOperations::Rotate(const CStdString &method, ITransportLayer *transport, IClient *client, const Value &parameterObject, Value &result)
index 5639369..7bc2d7e 100644 (file)
@@ -449,6 +449,116 @@ namespace JSONRPC
             "{ \"name\": \"value\", \"$ref\": \"Player.SeekPercentage\", \"required\": true }"
         "],"
         "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.PlayPause\": {"
+        "\"type\": \"method\","
+        "\"description\": \"Pauses or unpause slideshow\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": [],"
+        "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.Stop\": {"
+        "\"type\": \"method\","
+        "\"description\": \"Stops slideshow\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": [],"
+        "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.SkipPrevious\": {"
+        "\"type\": \"method\","
+        "\"description\": \"Skips to previous picture in the slideshow\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": [],"
+        "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.SkipNext\": {"
+        "\"type\": \"method\","
+        "\"description\": \"Skips to next picture in the slideshow\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": [],"
+        "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.MoveLeft\": {"
+        "\"type\": \"method\","
+        "\"description\": \"If picture is zoomed move viewport left otherwise skip previous\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": [],"
+        "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.MoveRight\": {"
+        "\"type\": \"method\","
+        "\"description\": \"If picture is zoomed move viewport right otherwise skip next\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": [],"
+        "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.MoveDown\": {"
+        "\"type\": \"method\","
+        "\"description\": \"If picture is zoomed move viewport down\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": [],"
+        "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.MoveUp\": {"
+        "\"type\": \"method\","
+        "\"description\": \"If picture is zoomed move viewport up\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": [],"
+        "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.ZoomOut\": {"
+        "\"type\": \"method\","
+        "\"description\": \"Zoom out once\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": [],"
+        "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.ZoomIn\": {"
+        "\"type\": \"method\","
+        "\"description\": \"Zoom in once\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": [],"
+        "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.Zoom\": {"
+        "\"type\": \"method\","
+        "\"description\": \"Zooms current picture\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": ["
+            "{ \"name\": \"value\", \"type\": \"integer\", \"required\": true, \"minimum\": 1, \"maximum\": 10, \"description\": \"Zoom level\" }"
+        "],"
+        "\"returns\": \"string\""
+    "},"
+    "\"PicturePlayer.Rotate\": {"
+        "\"type\": \"method\","
+        "\"description\": \"Rotates current picture\","
+        "\"transport\": \"Response\","
+        "\"permission\": \"ControlPlayback\","
+        "\"statechanging\": true,"
+        "\"params\": [],"
+        "\"returns\": \"string\""
     "}"
   "}";