2024-12-10, 06:56
JSONRPC.NotifyAll resquest sent but onNotification method of custom monitor class doesn't seem to be called. Is there any specific things to do?
import json
data = {'test': 'data'}
testaddon_data = json.dumps(data)
jsonrpc_request = {
"jsonrpc": "2.0",
"id": 1,
"method": "JSONRPC.NotifyAll",
"params": {
"sender": 'plugin.video.kodiconnect.SIGNAL',
"message": 'testaddon_data',
"data": [testaddon_data],
}
}
request = json.dumps(jsonrpc_request)
print(request)
{"jsonrpc": "2.0", "id": 1, "method": "JSONRPC.NotifyAll", "params": {"sender": "plugin.video.kodiconnect.SIGNAL", "message": "testaddon_data", "data": ["{\"test\": \"data\"}"]}}
import xbmc
class Monitor(xbmc.Monitor):
def __init__(self, **kwargs):
xbmc.Monitor.__init__(self)
def onNotification(self, sender, method, data):
xbmc.log("Monitor: sender %s, method: %s, data: %s" % (sender, method, data),level=xbmc.LOGINFO)
xbmcmon = Monitor()
while not xbmcmon.abortRequested():
xbmcmon.waitForAbort(10)
del xbmcmon