Kodi Community Forum

Full Version: JSONRPC to start add-on subitem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys,

I have the following json working to execute an add-on:

{"jsonrpc": "2.0", "method": "Addons.ExecuteAddon", "params": { "addonid": "plugin.video.dr.dk.live"}, "id": "1"}

However this only opens the add-on, I would like to then select
A subitem within the addon .. The add-on itself has say 10 channels
To pick from.. 'DR1' , 'DR2' etc..

Is there a way to pass the subitem to execute as part of the params ?

Cheers

G
You need to use Files.GetDirectory with plugin://plugin.video.dr.dk.live/ as the directory path and then you get the list of items that the addon would also show in the user interface. Then you can use these items' paths to either browse deeper into the hierarchy or to play one of the items using Player.Open.
Awesome ! Thx I got it all working like a charm, been away for a few days so just got it try it earlier today...



$ curl --header 'Content-Type: application/json' --data-binary '{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory":"plugin://plugin.video.dr.dk.live/", "media":"files"}, "id": "1"}' http://10.1.1.3:803/jsonrpc


{"id":"1","jsonrpc":"2.0","result":{"files":[{"file":"plugin://plugin.video.dr.dk.live/?playChannel=1","filetype":"file","label":"DR1","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=2","filetype":"file","label":"DR2","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=6","filetype":"file","label":"DR3","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=3","filetype":"file","label":"DR Ultra","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=4","filetype":"file","label":"DR K","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=5","filetype":"file","label":"DR Ramasjang","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=100","filetype":"file","label":"TV 2/FYN","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=101","filetype":"file","label":"Lorry","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=102","filetype":"file","label":"TV SYD","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=103","filetype":"file","label":"TV/MIDT-VEST","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=105","filetype":"file","label":"TV2/Nord","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=106","filetype":"file","label":"TV2 ØST","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=108","filetype":"file","label":"TV 2 | ØSTJYLLAND","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=109","filetype":"file","label":"TV 2/Bornholm","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=201","filetype":"file","label":"Folketinget TV","type":"unknown"},{"file":"plugin://plugin.video.dr.dk.live/?playChannel=203","filetype":"file","label":"Kanal Sport","type":"unknown"}],"limits":{"end":16,"start":0,"total":16}}}





curl --header 'Content-Type: application/json' --data-binary '{"jsonrpc": "2.0", "method": "Player.Open", "params": {"item": {"file":"plugin://plugin.video.dr.dk.live/?playChannel=3"}}, "id": "1"}' http://10.1.1.3:803/jsonrpc
{"id":"1","jsonrpc":"2.0","result":"OK"}

'{"jsonrpc": "2.0", "method": "Player.Open", "params": {"item": {"file":"plugin://plugin.video.dr.dk.live/?playChannel=5"}}, "id": "1"}'