Script to change a addon setting - 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: Script to change a addon setting (/showthread.php?tid=198911) |
Script to change a addon setting - jorgercosta - 2014-06-29 Is it possible to use a script to change a specific addon setting, I would like to map a key to enable disable an addon setting (on/off) the addon would be a service. Thank's RE: Script to change a addon setting - Karnagious - 2014-06-29 Yep. Code: import xbmc RE: Script to change a addon setting - jorgercosta - 2014-06-29 Thank's I was going for setting of the addon, like username, password, server etc ... I building a service that downloads and plays video from a company internal server, the service is built so that if, for any reason, no video is available a fallback video is played. I need a way to pause the service (for maintenance, so that i can access xbmc gui) i was thinking of checking a setting like "service_paused" , during the service loop this setting would be checked and if true video player would stop. Also the service manages client queues, i am using the tv remote to increase / decrease current client number, using a simple script mapped to the remote buttons but i would like to save current client number in case a reboot is needed . I was look at xbmcaddon.Addon ('script.foo.bar') Sorry for my English. Again any help is much appreciated RE: Script to change a addon setting - Samu-rai - 2014-07-10 Thanks for the info Karnagious. Are the only areas that need to be amended in the code: Code: ADDONID = 'your addon id goes here' & Code: "id":1 If so, I assume the id relates to the 'setting ID' in settings.xml, but can't seem to get the script to enable/disable as hoped. RE: Script to change a addon setting - ironic_monkey - 2014-07-11 no, the suggested code is to enable/disable an addon in its entirety. while you in principle can do Code: addon = xbmcaddon.Addon('service.foo') this will only update the xml file, but it won't signal a running service. RE: Script to change a addon setting - jorgercosta - 2014-07-11 I use a loop in my service script that check for a change in the settings PHP Code: import xbmc, xbmcgui, xbmcaddon; you can use this in other scripts called by your addon RE: Script to change a addon setting - Karnagious - 2014-07-11 If you have a service running you can create a Monitor which will announce when the settings change through the onSettingsChanged() method. Code: class LazyMonitor(xbmc.Monitor): |