JSON-RPC: Single command to play latest episode of set tvshowid?
#1
I'm trying to figure out how to make a single request that triggers Kodi to play the latest added episode of a TV-Show without first issuing a command to list the episodes of that show.
The usage would be in a home automation scenario to trigger a request from a third-party physical or software device to start playing a particular show.
I'm imagining something like "Google, show me XYZ", "Alexa, play my favourite show" or "Hey Siri, play XYZ"

I'm stuck trying to figure out this: http://192.168.XYZ.XYZ:8080/jsonrpc?request={"jsonrpc":"2.0","method":"Player.Open","params":{??????????}

Known and preconfigured in the command would be the tvshowid but not the id of the latest episode.

Does anyone have any suggestions on how to solve this?
Reply
#2
Sorry to hijack this thread, but what would be the params to play a specific movie or episode by ID ?
Reply
#3
I'm guessing it's similar to this but replace item file with id.

{"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item":{"file":"/storage/PATH/TO/FILE"}}}
Reply
#4
Thanks, I know how to do it by file path, but I want to do it by ID, and all combinations I tryed with id, movieid, episodeid, didn't work
Reply
#5
https://kodi.wiki/view/JSON-RPC_API <<< Behind the curtain Smile

https://forum.kodi.tv/showthread.php?tid=172734 <<< Handy utility for experimentation.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#6
Thanks!

I've had a look at the API doc (a lot), but the question remains if you can do it in one API call. I know I can get items, Playlist.Insert, then Player.Open but that is three calls instead of one, with the need to capture variables.
Reply
#7
(2018-08-09, 20:42)Znax Wrote: Thanks!

I've had a look at the API doc (a lot), but the question remains if you can do it in one API call. I know I can get items, Playlist.Insert, then Player.Open but that is three calls instead of one, with the need to capture variables.
 The info you need is all in the doc Smile

https://kodi.wiki/view/JSON-RPC_API/v8#Player.Open

I'd use the playlist "videodb://recentlyaddedepisodes/" if this doesn't work, create a "xsp" smartplaylist.
and the parameter "position:0"
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#8
Ah, that's a good idea! Thx, will give it a try!
Reply
#9
No single command but can be achieved in 3 commands; Get Show ID, Get Next Episode, Play.

An extract from the controller I am building for Voice Controls via OpenHAB/Alex/Google Home:

php:

$shows = json_decode(kodiGetTVShows($subject),true);
$episode = json_decode(kodiGetTVEpisodes($shows['result']['tvshows'][0]['tvshowid'], false, 1),true);
kodiPlayTVEpisode($episode['result']['episodes'][0]['episodeid']);

Full Source Code for my work so far.
Reply

Logout Mark Read Team Forum Stats Members Help
JSON-RPC: Single command to play latest episode of set tvshowid?0