Executing JSONRPC command from remote.xml?
#1
Hey all,

Im trying to run a jsonrpc command from my remote via remote.xml but I cant get it to work. Here is a snippet from my remote.xml

Code:
<keymap>
  <global>
    <remote>
      <livetv>XBMC.executeJSONRPC('{"id":1,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"channelid":1}}}')</livetv>
      <play>Play</play>
      <pause>Pause</pause>

The command below works from the commandline:
Code:
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":1,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"channelid":1}}}' http://localhost:8098/jsonrpc

If I change <livetv> to XBMC.ActivateWindow(Weather) it works as should. Whats strange is that when I have the jsonrpc command in <livetv> it acts in the xbmc default behaviour and shows the tv channels overview. Here is the section of my debug log file.

Code:
12:28:51 T:3016713984   DEBUG: LIRC: Update - NEW at 18402:182 0 KEY_TUNER devinput (KEY_TUNER)
12:28:51 T:3016713984   DEBUG: OnKey: 24 (18) pressed, action is XBMC.ActivateWindowAndFocus(MyPVR, 32,0, 11,0)
12:28:51 T:3016713984   DEBUG: Activating window ID: 10601
12:28:52 T:3016713984   DEBUG: ------ Window Deinit (MyPVR.xml) ------
12:28:52 T:3016713984   DEBUG: ------ Window Init (MyPVR.xml) ------
12:28:52 T:3016713984    INFO: Loading skin file: MyPVR.xml, load type: LOAD_EVERY_TIME
12:28:52 T:3016713984   DEBUG: Using already stored xml root node for /usr/share/xbmc/addons/skin.confluence/720p/MyPVR.xml
12:28:52 T:3016713984   DEBUG: CGUIMediaWindow::GetDirectory (pvr://channels/tv/All TV channels/)
12:28:52 T:3016713984   DEBUG:   ParentPath = []
12:28:52 T:3016713984   DEBUG: CPVRDirectory::GetDirectory(pvr://channels/tv/All TV channels)
12:28:52 T:3016713984   DEBUG: CGUIWindowPVRCommon - OnMessageFocus - focus set to window 'tv'
12:28:52 T:3016713984   DEBUG: CGUIWindowPVRChannels - UpdateData - update window 'tv'. set view to 11

Is it possible to execute jsonrpc commands from remote.xml? I couldnt seem to find much info about it online. Anyone have any ideas?

Thanks in advance.
Reply
#2
Maybe you can have your remote.xml use RunScript to execute a script that, in turn, executes JSONRPC?
Reply
#3
Thanks artrafael. Ive since gotten it to work via irexec and RunScript is another option. Im still curious as to whether this can be done as the same line in remote.xml could be used on different platforms.I forgot to mention Ive tried a couple of thing from the jsonrpc api wiki page but still had no success.
Reply
#4
I'm afraid I can't be of much help with JSONRPC... I've had limited success trying to update a few simple scripts I use that need to have HTTPAPI replaced by JSONRPC. Sad
Reply
#5
Yeah I struggle with jsonrpc too, although with help from these forums and perseverance I usually get there eventually.
Reply
#6
From here is seems as though its only possible for addons to use executeJSONRPC.

http://wiki.xbmc.org/index.php?title=JSO...API#Python

I dont think that any of the other transports listed on that page could be used.

Any suggestions?
Reply

Logout Mark Read Team Forum Stats Members Help
Executing JSONRPC command from remote.xml?0