def JSONRPC(method, params={}):
"""
Execute JSON-RPC method
:param method: name of the method. Example "Input.Back"
:type method: str
:param params: dictionary with parameter values
:type params: dict
:return: response as a string or None (in case of exception)
:rtype: str or None
"""
data = {
"jsonrpc": "2.0",
"id": 1,
"method": method,
"params": params
}
command = json.dumps(data)
try:
response = xbmc.executeJSONRPC(command)
except Exception, e:
log_exception("Error executing JSON RPC method " + method)
log_exception("Params: " + str(params))
log_exception(str(e))
return None
return response
评论列表
文章目录