How to play the most recent item with JSON-RPC?
#1
Question 
Hello all,

I would like to send commands to play the most recent video from a list shown by an addon (plugin.video.belgium).  I am reading and reading again the docs but I cannot find anything.  Is it even possible?

I am currently only able to execute the addon to fetch and list the videos with the command below then I am stuck.

json:
{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"wait":True,"addonid":"plugin.video.belgium","params": ["?action=show_videos&channel_id=rtbf&id=5&name=Journal%20t%c3%a9l%c3%a9vis%c3%a9%2019h30&url=https%3a%2f%2fwww.rtbf.be%2fauvio%2femissions%2fdetail_journal-televise-19h30%3fid%3d5"]},"id":1}

I guess the logical next steps would be to get the list of the items and play the most recent one...  I would appreciate if anyone could guide me to the right direction.
Reply
#2
Ok that was a lot of trials and error but I found a way.  I put the solution here in case it can help others.

1. Retrieve the items.
json:
{"jsonrpc":"2.0","id":1,"method":"Files.GetDirectory","params":{"directory":dir,"sort":{"method":"none","order":"ascending"}}}

with dir = "plugin://plugin.video.belgium/?action=show_videos&channel_id=rtbf&id=5&name=Journal%20t%c3%a9l%c3%a9vis%c3%a9%2019h30&url=https%3a%2f%2fwww.rtbf.be%2fauvio%2femissions%2fdetail_journal-televise-19h30%3fid%3d5".  This path can be obtained by analyzing the Kodi logs (with debug on) while navigating to the desired directory or by sending the following command when we are in the desired directory.

json:
{"jsonrpc":"2.0","id":1,"method":"XBMC.GetInfoLabels","params": {"labels":["Container.FolderPath"]}}

2. Play the first item.
json:
{"jsonrpc": "2.0", "id": 1, "method": "Player.Open","params":{"item":{"file":first_file}}}

with first_file = response_json["result"]["files"][0]["file"] (in Python)
Reply

Logout Mark Read Team Forum Stats Members Help
How to play the most recent item with JSON-RPC?0