PKGBUILDs/alarm/kodi-rpi-git/0002-Revert-jsonrpc-remove-ambiguous-and-duplicate-Player.patch

63 lines
3.7 KiB
Diff

From 88b3174bdc47bfa7fb0e798ef0d01cd0bdf8e734 Mon Sep 17 00:00:00 2001
From: graysky <graysky@archlinux.us>
Date: Tue, 29 Dec 2020 14:42:12 -0500
Subject: [PATCH] Revert "[jsonrpc] remove ambiguous and duplicate Player.Seek
options"
This reverts commit 3801ec4b07d74c81d830c83c799ae90228c5cf2e.
---
xbmc/interfaces/json-rpc/PlayerOperations.cpp | 14 +++++++-------
xbmc/interfaces/json-rpc/schema/methods.json | 3 +++
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/xbmc/interfaces/json-rpc/PlayerOperations.cpp b/xbmc/interfaces/json-rpc/PlayerOperations.cpp
index 8572736bef..d472a6951f 100644
--- a/xbmc/interfaces/json-rpc/PlayerOperations.cpp
+++ b/xbmc/interfaces/json-rpc/PlayerOperations.cpp
@@ -401,11 +401,11 @@ JSONRPC_STATUS CPlayerOperations::Seek(const std::string &method, ITransportLaye
return FailedToExecute;
const CVariant& value = parameterObject["value"];
- if (value.isMember("percentage"))
- g_application.SeekPercentage(value["percentage"].asFloat());
- else if (value.isMember("step"))
+ if (IsType(value, NumberValue) || value.isMember("percentage"))
+ g_application.SeekPercentage(IsType(value, NumberValue) ? value.asFloat() : value["percentage"].asFloat());
+ else if (value.isString() || value.isMember("step"))
{
- std::string step = value["step"].asString();
+ std::string step = value.isString() ? value.asString() : value["step"].asString();
if (step == "smallforward")
CBuiltins::GetInstance().Execute("playercontrol(smallskipforward)");
else if (step == "smallbackward")
@@ -417,10 +417,10 @@ JSONRPC_STATUS CPlayerOperations::Seek(const std::string &method, ITransportLaye
else
return InvalidParams;
}
- else if (value.isMember("seconds"))
+ else if (value.isMember("seconds") && value.size() == 1)
g_application.GetAppPlayer().GetSeekHandler().SeekSeconds(static_cast<int>(value["seconds"].asInteger()));
- else if (value.isMember("time"))
- g_application.SeekTime(ParseTimeInSeconds(value["time"]));
+ else if (value.isObject())
+ g_application.SeekTime(ParseTimeInSeconds(value.isMember("time") ? value["time"] : value));
else
return InvalidParams;
diff --git a/xbmc/interfaces/json-rpc/schema/methods.json b/xbmc/interfaces/json-rpc/schema/methods.json
index d23ad943d7..a2e2927b2a 100644
--- a/xbmc/interfaces/json-rpc/schema/methods.json
+++ b/xbmc/interfaces/json-rpc/schema/methods.json
@@ -295,6 +295,9 @@
"params": [
{ "name": "playerid", "$ref": "Player.Id", "required": true },
{ "name": "value", "required": true, "type": [
+ { "$ref": "Player.Position.Percentage", "required": true, "description": "Percentage value to seek to" },
+ { "$ref": "Player.Position.Time", "required": true, "description": "Time to seek to" },
+ { "type": "string", "enum": [ "smallforward", "smallbackward", "bigforward", "bigbackward" ], "required": true, "description": "Seek by predefined jumps" },
{ "type": "object", "properties": { "percentage": { "$ref": "Player.Position.Percentage", "required": true, "description": "Percentage value to seek to" } }, "additionalProperties": false, "required": true },
{ "type": "object", "properties": { "time": { "$ref": "Player.Position.Time", "required": true, "description": "Time to seek to" } }, "additionalProperties": false, "required": true },
{ "type": "object", "properties": { "step": { "type": "string", "enum": [ "smallforward", "smallbackward", "bigforward", "bigbackward" ], "required": true, "description": "Seek by predefined jumps" } }, "additionalProperties": false, "required": true },
--
2.30.0