Activate Custom Window ID with Json-RPC
#1
Hi All

In my case I want to Activate custom window by using Jason RPC and I created an addon to open new window with ID :1199" and here is the script.py in addon:

import xbmc
import xbmcgui

xbmc.executebuiltin('ActivateWindow(1199)')

After that I created another script python to execute a Jason rpc :

import requests

headers = {
    'Content-Type': 'application/json',
}

data = '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.activatewindowid,"params":{"windowid":"1199"}}}'

response = requests.post('http://192.168.1.250:8080/jsonrpc',
headers=headers,
data=data,
auth=('kodi', '1234'))

the jaso rpc script is out from kodi sender successfully I saw it in log.

But the kodi receiver I got this log:

ERROR: JSONRPC: Failed to parse '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.activatewindowid,"params":{"windowid":"1199"}}}'

What is the problem here?

Thanks for you guys
Reply
#2
I tried this also but same not solved:

import requests

headers = {
    'Content-Type': 'application/json',
}

data = '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.activatewindowid","params":{"windowid":"1199"}},"id":1}'

response = requests.post('http://192.168.1.250:8080/jsonrpc',
headers=headers,
data=data,
auth=('kodi', '1234'))
Reply
#3
Can you try to do it like this:

data = '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid"Confusedcript.activatewindowid,"params":{"windowid":"1199"}}}'
Reply
#4
I tired it but still the same not working...

I tried the addon locally is working and opened a custom window.

but I need to open it with RPC remotely
Reply
#5
addon.xml content:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.activatewindowid" name="windows" version="1.1.1" provider-name="mks">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
</requires>
<extension point="xbmc.python.script" library="script.py">
<provides>executable</provides>
</extension>
<extension point="xbmc.addon.metadata">
<language></language>
<summary lang="en">Open custom Window</summary>
<description lang="en">Call this addon from the xbmc json-rpc to open custom Window. Example:
{"jsonrpc":"2.0","method":"Addons.ExecuteAddon",
"params":{"addonid":"script.activatewindowid",
"params":{"windowid":"1199"}},"id":1}</description>
<platform>all</platform>
<website></website>
<forum></forum>
<email></email>
</extension>
</addon>

I am really confused where is the issue in this:
data = '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.activatewindowid","params":{"command":"activate"}},"id":1}'
??
Reply
#6
Any Idea please Angel
Reply
#7
Hi

I made like this:
import requests

headers = {
    'Content-Type': 'application/json',
}

data = '{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params":{"addonid":"script.activatewindowid","params":{"windowid":"1199"}},"id":0}'

response = requests.post('http://192.168.1.200:8080/jsonrpc',
headers=headers,
data=data,
auth=('kodi', '1234'))


and the log in receiver kodi this:
16:26:37.678 T:139921770186496 DEBUG: CWebServer[8080]: request received for /jsonrpc


it seems the rpc is successed but the addon script.activatewindowid not working in the receiver kodi user!

what could be the issue here?

Thanks for all
Reply
#8
the addon structure:
1-addon.xml
2-icon.png
3-license.txt
4-readme.txt
5-script.py

Is the problem from Addon side?

thanks for your appreciated support
Reply

Logout Mark Read Team Forum Stats Members Help
Activate Custom Window ID with Json-RPC0