diff --git a/addon.xml b/addon.xml index ecefb7c03..82972f7ad 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index ccd413b03..39e5b2343 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +## v7.0.3.2 +### Fixed +- Fix settings not being saved and setup wizard repeatedly activating in Kodi 20 and lower #604 +- Fix plugin refresh on settings change + ## v7.0.3.1 ### Fixed - Restore support for old format plugin urls used for trailers #598 diff --git a/resources/lib/youtube_plugin/kodion/script_actions.py b/resources/lib/youtube_plugin/kodion/script_actions.py index 3a48c09a9..36569eddc 100644 --- a/resources/lib/youtube_plugin/kodion/script_actions.py +++ b/resources/lib/youtube_plugin/kodion/script_actions.py @@ -27,7 +27,6 @@ def _config_actions(action, *_args): if action == 'youtube': xbmcaddon.Addon().openSettings() - xbmc.executebuiltin('Container.Refresh') elif action == 'isa': if context.use_inputstream_adaptive(): diff --git a/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py b/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py index 9ff3e5b6d..5100e1af4 100644 --- a/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py +++ b/resources/lib/youtube_plugin/kodion/settings/abstract_settings.py @@ -28,6 +28,7 @@ class AbstractSettings(object): _echo = False _cache = {} + _check_set = True _type = None @classmethod diff --git a/resources/lib/youtube_plugin/kodion/settings/xbmc/xbmc_plugin_settings.py b/resources/lib/youtube_plugin/kodion/settings/xbmc/xbmc_plugin_settings.py index 5e0776fa8..a8f09de5e 100644 --- a/resources/lib/youtube_plugin/kodion/settings/xbmc/xbmc_plugin_settings.py +++ b/resources/lib/youtube_plugin/kodion/settings/xbmc/xbmc_plugin_settings.py @@ -23,9 +23,16 @@ def __init__(self, xbmc_addon): self.flush(xbmc_addon) - if current_system_version.compatible(20, 0): + if current_system_version.compatible(21, 0): _class = xbmcaddon.Settings + # set methods in new Settings class are documented as returning a + # bool, True if value was set, False otherwise, similar to how the + # old set setting methods of the Addon class function. Except they + # don't actually return anything... + # Ignore return value until bug is fixed in Kodi + XbmcPluginSettings._check_set = False + self.__dict__.update({ '_get_bool': _class.getBool, '_set_bool': _class.setBool, @@ -61,7 +68,7 @@ def _set_string_list(store, setting, value): def flush(cls, xbmc_addon): cls._echo = get_kodi_setting('debug.showloginfo') cls._cache = {} - if current_system_version.compatible(20, 0): + if current_system_version.compatible(21, 0): cls._type = xbmc_addon.getSettings else: cls._type = xbmcaddon.Addon @@ -97,9 +104,10 @@ def get_bool(self, setting, default=None, echo=None): def set_bool(self, setting, value, echo=None): try: error = not self._set_bool(self._type(), setting, value) - if error: + if error and self._check_set: error = 'failed' else: + error = False self._cache[setting] = value except (RuntimeError, TypeError) as exc: error = exc @@ -145,9 +153,10 @@ def get_int(self, setting, default=-1, process=None, echo=None): def set_int(self, setting, value, echo=None): try: error = not self._set_int(self._type(), setting, value) - if error: + if error and self._check_set: error = 'failed' else: + error = False self._cache[setting] = value except (RuntimeError, TypeError) as exc: error = exc @@ -191,9 +200,10 @@ def get_string(self, setting, default='', echo=None): def set_string(self, setting, value, echo=None): try: error = not self._set_str(self._type(), setting, value) - if error: + if error and self._check_set: error = 'failed' else: + error = False self._cache[setting] = value except (RuntimeError, TypeError) as exc: error = exc @@ -239,9 +249,10 @@ def get_string_list(self, setting, default=None, echo=None): def set_string_list(self, setting, value, echo=None): try: error = not self._set_str_list(self._type(), setting, value) - if error: + if error and self._check_set: error = 'failed' else: + error = False self._cache[setting] = value except (RuntimeError, TypeError) as exc: error = exc diff --git a/resources/lib/youtube_plugin/kodion/utils/service_monitor.py b/resources/lib/youtube_plugin/kodion/utils/service_monitor.py index b4c78e24a..ad46879b7 100644 --- a/resources/lib/youtube_plugin/kodion/utils/service_monitor.py +++ b/resources/lib/youtube_plugin/kodion/utils/service_monitor.py @@ -83,6 +83,10 @@ def onNotification(self, sender, method, data): def onSettingsChanged(self): self._settings.flush(xbmcaddon.Addon(ADDON_ID)) + if xbmc.getInfoLabel('Container.FolderPath').startswith( + 'plugin://{0}/'.format(ADDON_ID) + ): + xbmc.executebuiltin('Container.Refresh') data = { 'use_httpd': (self._settings.use_mpd_videos()