2019-12-12, 20:01
I am working on a plugin and I am looking for some best practices / help / advice. I see that as part of a plugin you can have a service that runs in the background while Kodi is active. I was thinking I would use this service to perform background monitoring (to provide notifications / alerts) and caching for the main plugin (slower api calls). From the plugin I was successfully able to make a call via JSONRPC and to look up settings via:
What I have not been able to find a way to do is have the plugin making a blocking call to the service to get some data. Is there a way my service can create JSONRPC response that my plugin can call? Do I start a web service running on local host in the service and make calls to that? Is there some other (correct / better) way to do this?
Another question I have is about long running operations performed by the service. If I wanted to add a background downloader to my service is it safe to spawn a thread from the service to complete that task so I don't block the check to see Kodi has terminated?
One final question pertains to programmatically selecting a
python:
result = xbmc.executeJSONRPC(command)
python:
xbmcaddon.Addon()
What I have not been able to find a way to do is have the plugin making a blocking call to the service to get some data. Is there a way my service can create JSONRPC response that my plugin can call? Do I start a web service running on local host in the service and make calls to that? Is there some other (correct / better) way to do this?
Another question I have is about long running operations performed by the service. If I wanted to add a background downloader to my service is it safe to spawn a thread from the service to complete that task so I don't block the check to see Kodi has terminated?
One final question pertains to programmatically selecting a
ListItem
in a directory. I see there is a method select
on the ListItem
. When I call that method on the ListItem
the entry appears to have a different color treatment but the selected
entry in the directory still seems to be ..
. Is doing this possible?