Plugin To Service Communication
#1
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:

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?
Kodi 19.0 | Ubuntu 20.04.2 | Kernel 5.4.0-67-generic | Intel i7-8700K | ASRock Z370 Gaming-ITX/ac | Ballistix Sport LT 2x16384MB (DDR4-2666) | Samsung 970 PRO 1TB |LG WH16NS60 | Cooler Master Elite 130 | Yamaha RX-A780Samsung Q70R
Reply
#2
(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:

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?

Bump... Any one?
Kodi 19.0 | Ubuntu 20.04.2 | Kernel 5.4.0-67-generic | Intel i7-8700K | ASRock Z370 Gaming-ITX/ac | Ballistix Sport LT 2x16384MB (DDR4-2666) | Samsung 970 PRO 1TB |LG WH16NS60 | Cooler Master Elite 130 | Yamaha RX-A780Samsung Q70R
Reply

Logout Mark Read Team Forum Stats Members Help
Plugin To Service Communication0