I'm trying to migrate away from setting the PVRManager on/off to enabling/disabling the actual PVR Plugin via json rpc.
I do this in order to force he client to disconnect from the pvr server.
While the old approach worked, setting the Addon to Enabled=false does not cause a disconnect.
#!/usr/bin/python
import os
import sys
import json, requests
from json import JSONEncoder
url = "http://192.168.1.100:8080/jsonrpc"
def activate(enable) :
payload = {'jsonrpc': '2.0','method': 'Addons.SetAddonEnabled', 'params' : {'addonid': "pvr.vdr.vnsi", 'enabled': enable},'id':1}
resp = requests.post(url=url, json=payload)
#out = resp.text
#print (out)
def touch(fname, times=None):
fhandle = open(fname, 'a')
try:
os.utime(fname, times)
finally:
fhandle.close()
if str(sys.argv[1]) == "true" :
touch("/tmp/kodiidle")
activate(False)
#xbmc.executebuiltin('xbmc.' + 'StopPVRManager')
else:
try:
os.remove("/tmp/kodiidle")
except:
pass
activate(True)
#xbmc.executebuiltin('xbmc.' + 'StartPVRManager')