aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormontellese <montellese@xbmc.org>2012-01-31 16:15:10 +0100
committermontellese <montellese@xbmc.org>2012-03-27 16:43:44 +0200
commit0af3ce037ef81fbc8177e2d4f8134f58e8700146 (patch)
treed772ccd2124ad879977da5d3173bd1b62bb16df4
parent642c371e813bf21daaebb0564ca3816e8cd88a12 (diff)
jsonrpc: add optional "play" parameter to Player.PlayPause (closes #12564)
-rw-r--r--xbmc/interfaces/json-rpc/JSONUtils.h2
-rw-r--r--xbmc/interfaces/json-rpc/PlayerOperations.cpp14
-rw-r--r--xbmc/interfaces/json-rpc/ServiceDescription.h21
-rw-r--r--xbmc/interfaces/json-rpc/methods.json15
-rw-r--r--xbmc/interfaces/json-rpc/types.json6
5 files changed, 33 insertions, 25 deletions
diff --git a/xbmc/interfaces/json-rpc/JSONUtils.h b/xbmc/interfaces/json-rpc/JSONUtils.h
index 20c8c25bf8..4b8d955fbe 100644
--- a/xbmc/interfaces/json-rpc/JSONUtils.h
+++ b/xbmc/interfaces/json-rpc/JSONUtils.h
@@ -369,7 +369,7 @@ namespace JSONRPC
value = CVariant(CVariant::VariantTypeObject);
break;
default:
- value = CVariant(CVariant::VariantTypeConstNull);
+ value = CVariant(CVariant::VariantTypeNull);
}
}
diff --git a/xbmc/interfaces/json-rpc/PlayerOperations.cpp b/xbmc/interfaces/json-rpc/PlayerOperations.cpp
index aa72e1d9e6..0fb8db3fed 100644
--- a/xbmc/interfaces/json-rpc/PlayerOperations.cpp
+++ b/xbmc/interfaces/json-rpc/PlayerOperations.cpp
@@ -182,13 +182,23 @@ JSONRPC_STATUS CPlayerOperations::PlayPause(const CStdString &method, ITransport
{
case Video:
case Audio:
- CBuiltins::Execute("playercontrol(play)");
+ if (parameterObject["play"].isString())
+ CBuiltins::Execute("playercontrol(play)");
+ else
+ {
+ if (parameterObject["play"].asBoolean() == g_application.IsPaused())
+ g_application.getApplicationMessenger().MediaPause();
+ }
result["speed"] = g_application.IsPaused() ? 0 : g_application.GetPlaySpeed();
return OK;
case Picture:
- SendSlideshowAction(ACTION_PAUSE);
slideshow = (CGUIWindowSlideShow*)g_windowManager.GetWindow(WINDOW_SLIDESHOW);
+ if (slideshow && slideshow->IsPlaying() &&
+ (parameterObject["play"].isString() ||
+ (parameterObject["play"].isBoolean() && parameterObject["play"].asBoolean() == slideshow->IsPaused())))
+ SendSlideshowAction(ACTION_PAUSE);
+
if (slideshow && slideshow->IsPlaying() && !slideshow->IsPaused())
result["speed"] = slideshow->GetDirection();
else
diff --git a/xbmc/interfaces/json-rpc/ServiceDescription.h b/xbmc/interfaces/json-rpc/ServiceDescription.h
index 4eb7765bcd..16edc3d83e 100644
--- a/xbmc/interfaces/json-rpc/ServiceDescription.h
+++ b/xbmc/interfaces/json-rpc/ServiceDescription.h
@@ -53,6 +53,12 @@ namespace JSONRPC
"\"type\": \"string\","
"\"enum\": [ \"increment\", \"decrement\" ]"
"}",
+ "\"Global.Toggle\": {"
+ "\"type\": ["
+ "{ \"type\": \"boolean\", \"required\": true },"
+ "{ \"type\": \"string\", \"enum\": [ \"toggle\" ], \"required\": true }"
+ "]"
+ "}",
"\"Configuration.Notifications\": {"
"\"type\": \"object\","
"\"properties\": {"
@@ -1004,7 +1010,8 @@ namespace JSONRPC
"\"transport\": \"Response\","
"\"permission\": \"ControlPlayback\","
"\"params\": ["
- "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true }"
+ "{ \"name\": \"playerid\", \"$ref\": \"Player.Id\", \"required\": true },"
+ "{ \"name\": \"play\", \"$ref\": \"Global.Toggle\", \"default\": \"toggle\" }"
"],"
"\"returns\": { \"$ref\": \"Player.Speed\" }"
"}",
@@ -2009,11 +2016,7 @@ namespace JSONRPC
"\"transport\": \"Response\","
"\"permission\": \"ControlGUI\","
"\"params\": ["
- "{ \"name\": \"fullscreen\", \"required\": true, \"type\": ["
- "{ \"type\": \"boolean\", \"required\": true },"
- "{ \"type\": \"string\", \"enum\": [ \"toggle\" ], \"required\": true }"
- "]"
- "}"
+ "{ \"name\": \"fullscreen\", \"required\": true, \"$ref\": \"Global.Toggle\" }"
"],"
"\"returns\": { \"type\": \"boolean\", \"description\": \"Fullscreen state\" }"
"}",
@@ -2170,11 +2173,7 @@ namespace JSONRPC
"\"transport\": \"Response\","
"\"permission\": \"ControlPlayback\","
"\"params\": ["
- "{ \"name\": \"mute\", \"required\": true, \"type\": ["
- "{ \"type\": \"boolean\", \"required\": true },"
- "{ \"type\": \"string\", \"enum\": [ \"toggle\" ], \"required\": true }"
- "]"
- "}"
+ "{ \"name\": \"mute\", \"required\": true, \"$ref\": \"Global.Toggle\" }"
"],"
"\"returns\": { \"type\": \"boolean\", \"description\": \"Mute state\" }"
"}",
diff --git a/xbmc/interfaces/json-rpc/methods.json b/xbmc/interfaces/json-rpc/methods.json
index 1f84f0c0d8..3b8faa6438 100644
--- a/xbmc/interfaces/json-rpc/methods.json
+++ b/xbmc/interfaces/json-rpc/methods.json
@@ -173,7 +173,8 @@
"transport": "Response",
"permission": "ControlPlayback",
"params": [
- { "name": "playerid", "$ref": "Player.Id", "required": true }
+ { "name": "playerid", "$ref": "Player.Id", "required": true },
+ { "name": "play", "$ref": "Global.Toggle", "default": "toggle" }
],
"returns": { "$ref": "Player.Speed" }
},
@@ -1178,11 +1179,7 @@
"transport": "Response",
"permission": "ControlGUI",
"params": [
- { "name": "fullscreen", "required": true, "type": [
- { "type": "boolean", "required": true },
- { "type": "string", "enum": [ "toggle" ], "required": true }
- ]
- }
+ { "name": "fullscreen", "required": true, "$ref": "Global.Toggle" }
],
"returns": { "type": "boolean", "description": "Fullscreen state" }
},
@@ -1339,11 +1336,7 @@
"transport": "Response",
"permission": "ControlPlayback",
"params": [
- { "name": "mute", "required": true, "type": [
- { "type": "boolean", "required": true },
- { "type": "string", "enum": [ "toggle" ], "required": true }
- ]
- }
+ { "name": "mute", "required": true, "$ref": "Global.Toggle" }
],
"returns": { "type": "boolean", "description": "Mute state" }
},
diff --git a/xbmc/interfaces/json-rpc/types.json b/xbmc/interfaces/json-rpc/types.json
index cd5f3f5470..4c38b759b3 100644
--- a/xbmc/interfaces/json-rpc/types.json
+++ b/xbmc/interfaces/json-rpc/types.json
@@ -25,6 +25,12 @@
"type": "string",
"enum": [ "increment", "decrement" ]
},
+ "Global.Toggle": {
+ "type": [
+ { "type": "boolean", "required": true },
+ { "type": "string", "enum": [ "toggle" ], "required": true }
+ ]
+ },
"Configuration.Notifications": {
"type": "object",
"properties": {