JSONRPC notification usage
#1
Hey!

I am trying to build a simple python script to control kodi from my linux machine. I can get the basic method calls to work and get the gist of how things are but when it comes to 'listening' for notifications such as Application.OnVolumeChanged, Player.OnPlay, etc., I have no idea where to start from, how to subscribe to these notifications. The best knowledge I have is the fact that notifications can be subscribed using websockets or TCP and the following piece of code,

Code:
import asyncio
import websockets
from jsonrpcclient.websockets_client import WebSocketsClient

async def main():
    async with websockets.connect('ws://192.168.1.104:9000') as ws:
        response = await WebSocketsClient(ws).request('Application.OnVolumeChanged')
        print(response)

asyncio.get_event_loop().run_until_complete(main())

One immediate thing I can notice with above code is authorization details aren't being sent to kodi. Apart from that, I have no clue where to go from here (and if this is indeed the right direction).

Any help will be appreciated Smile
Reply

Logout Mark Read Team Forum Stats Members Help
JSONRPC notification usage0