aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphunkyfish <phunkyfish@gmail.com>2020-10-26 12:31:39 +0000
committerphunkyfish <phunkyfish@gmail.com>2020-10-30 16:27:34 +0000
commit98e00561af1180470b6dae06da6a16fae500fd71 (patch)
treed0c1f0b7599b26ac731406912145cb923bc73cb9
parentae834071d35440f008c798653a05f4dee01d4652 (diff)
[pvr] json-rpc: deprecate isplayable field for broadcast and provide method instead
-rw-r--r--xbmc/interfaces/json-rpc/JSONServiceDescription.cpp1
-rw-r--r--xbmc/interfaces/json-rpc/PVROperations.cpp21
-rw-r--r--xbmc/interfaces/json-rpc/PVROperations.h5
-rw-r--r--xbmc/interfaces/json-rpc/schema/methods.json10
-rw-r--r--xbmc/interfaces/json-rpc/schema/types.json2
5 files changed, 38 insertions, 1 deletions
diff --git a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
index 93d014bae9..0fa23908ad 100644
--- a/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
+++ b/xbmc/interfaces/json-rpc/JSONServiceDescription.cpp
@@ -173,6 +173,7 @@ JsonRpcMethodMap CJSONServiceDescription::m_methodMaps[] = {
{ "PVR.GetChannelDetails", CPVROperations::GetChannelDetails },
{ "PVR.GetBroadcasts", CPVROperations::GetBroadcasts },
{ "PVR.GetBroadcastDetails", CPVROperations::GetBroadcastDetails },
+ { "PVR.GetBroadcastIsPlayable", CPVROperations::GetBroadcastIsPlayable },
{ "PVR.GetTimers", CPVROperations::GetTimers },
{ "PVR.GetTimerDetails", CPVROperations::GetTimerDetails },
{ "PVR.GetRecordings", CPVROperations::GetRecordings },
diff --git a/xbmc/interfaces/json-rpc/PVROperations.cpp b/xbmc/interfaces/json-rpc/PVROperations.cpp
index 2798aff71f..9487d8141b 100644
--- a/xbmc/interfaces/json-rpc/PVROperations.cpp
+++ b/xbmc/interfaces/json-rpc/PVROperations.cpp
@@ -16,6 +16,7 @@
#include "pvr/channels/PVRChannelGroupsContainer.h"
#include "pvr/epg/Epg.h"
#include "pvr/epg/EpgContainer.h"
+#include "pvr/epg/EpgInfoTag.h"
#include "pvr/guilib/PVRGUIActions.h"
#include "pvr/recordings/PVRRecordings.h"
#include "pvr/timers/PVRTimerInfoTag.h"
@@ -190,6 +191,26 @@ JSONRPC_STATUS CPVROperations::GetBroadcastDetails(const std::string &method, IT
return OK;
}
+JSONRPC_STATUS CPVROperations::GetBroadcastIsPlayable(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result)
+{
+ if (!CServiceBroker::GetPVRManager().IsStarted())
+ return FailedToExecute;
+
+ const std::shared_ptr<CPVREpgInfoTag> epgTag =
+ CServiceBroker::GetPVRManager().EpgContainer().GetTagById(
+ nullptr, parameterObject["broadcastid"].asUnsignedInteger());
+
+ if (!epgTag)
+ return InvalidParams;
+
+ result = epgTag->IsPlayable();
+
+ return OK;
+}
JSONRPC_STATUS CPVROperations::Record(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result)
{
diff --git a/xbmc/interfaces/json-rpc/PVROperations.h b/xbmc/interfaces/json-rpc/PVROperations.h
index d75df45f22..fcdf2b2ca0 100644
--- a/xbmc/interfaces/json-rpc/PVROperations.h
+++ b/xbmc/interfaces/json-rpc/PVROperations.h
@@ -27,6 +27,11 @@ namespace JSONRPC
static JSONRPC_STATUS GetChannelDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
static JSONRPC_STATUS GetBroadcasts(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
static JSONRPC_STATUS GetBroadcastDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
+ static JSONRPC_STATUS GetBroadcastIsPlayable(const std::string& method,
+ ITransportLayer* transport,
+ IClient* client,
+ const CVariant& parameterObject,
+ CVariant& result);
static JSONRPC_STATUS GetTimers(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
static JSONRPC_STATUS GetTimerDetails(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
static JSONRPC_STATUS GetRecordings(const std::string &method, ITransportLayer *transport, IClient *client, const CVariant &parameterObject, CVariant &result);
diff --git a/xbmc/interfaces/json-rpc/schema/methods.json b/xbmc/interfaces/json-rpc/schema/methods.json
index f1cfbf424f..96d5540faa 100644
--- a/xbmc/interfaces/json-rpc/schema/methods.json
+++ b/xbmc/interfaces/json-rpc/schema/methods.json
@@ -2095,6 +2095,16 @@
}
}
},
+ "PVR.GetBroadcastIsPlayable": {
+ "type": "method",
+ "description": "Retrieves whether or not a broadcast is playable",
+ "transport": "Response",
+ "permission": "ReadData",
+ "params": [
+ { "name": "broadcastid", "$ref": "Library.Id", "required": true, "description": "the id of the broadcast to to check for playability" }
+ ],
+ "returns": "boolean"
+ },
"PVR.GetTimers": {
"type": "method",
"description": "Retrieves the timers",
diff --git a/xbmc/interfaces/json-rpc/schema/types.json b/xbmc/interfaces/json-rpc/schema/types.json
index f923331954..0fafdb5f93 100644
--- a/xbmc/interfaces/json-rpc/schema/types.json
+++ b/xbmc/interfaces/json-rpc/schema/types.json
@@ -1052,7 +1052,7 @@
"hasrecording": { "type": "boolean" },
"recording": { "type": "string" },
"isseries": { "type": "boolean" },
- "isplayable": { "type": "boolean" }
+ "isplayable": { "type": "boolean", "description": "Deprecated - Use GetBroadcastIsPlayable instead" }
}
},
"PVR.Fields.Channel": {