2022-02-03, 10:55
I am donating an example that I wasn't able to find elsewhere. Maybe this is obvious to many but I struggled with it for a bit before I found an answer. I was looking for a way to pass a variable to a JSON RPC call. All of the examples I found had the string actually programmed into the RPC call. Here's what I came up with, which works:
playitem = '"' + piclist[slideIdx] + '"'
jjson_query = xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Player.Open", "params":{"item":{"file":%s }},"id":1}' % (playitem))
In this example piclist is a list of file names (accessed by URLs) and slideIdx is the index to the item in the list. This is part of a loop where I pass filenames to JSON RPC to play.
Jeff
playitem = '"' + piclist[slideIdx] + '"'
jjson_query = xbmc.executeJSONRPC('{"jsonrpc":"2.0", "method":"Player.Open", "params":{"item":{"file":%s }},"id":1}' % (playitem))
In this example piclist is a list of file names (accessed by URLs) and slideIdx is the index to the item in the list. This is part of a loop where I pass filenames to JSON RPC to play.
Jeff