How can I restart a service in Kodi?
#1
Question 
Hi,

My addon is running a service.
When a user change any setting in the addon Settings, he is required to restart kodi for the settings to take effect.

1) Is there any way to restart the service with the updated setting in order to avoid a restart.
2) If there isn't, so how can I show a dialog when a user press the "Ok" button to confirm the addon's setting that will tell him to make a restart?

Thanks.
Reply
#2
I am not sure of your service code but see this thread. Users shouldn't have to restart the service to see settings changes.  Here's an example service file where I detect settings changes without a restart.  Look at the various media.settings calls which go to a common read / write settings function.

Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#3
A service addon can listen for a change in settings and then reload the settings.

python:

def onSettingsChanged(self):
    self._init_vars()

This goes into the class for your service.  The def line is the one that defines the function that does something when settings change.  In the case above, my addon has a function that reinitializes all the variables (including reloading the settings).
Reply

Logout Mark Read Team Forum Stats Members Help
How can I restart a service in Kodi?0