Plugin To Service Communication - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: Plugin To Service Communication (/showthread.php?tid=350027) |
Plugin To Service Communication - mossman1120 - 2019-12-12 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 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?
RE: Plugin To Service Communication - mossman1120 - 2019-12-24 (2019-12-12, 20:01)mossman1120 Wrote: 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: Bump... Any one? |