def onSettingsChanged(self): logger.debug('settings changed') settings_post = config.get_all_settings_addon() from platformcode import xbmc_videolibrary if self.settings_pre.get('downloadpath', None) != settings_post.get( 'downloadpath', None): xbmc_videolibrary.update_sources( settings_post.get('downloadpath', None), self.settings_pre.get('downloadpath', None)) # si se ha cambiado la ruta de la videoteca llamamos a comprobar directorios para que lo cree y pregunte # automaticamente si configurar la videoteca if self.settings_pre.get("videolibrarypath", None) != settings_post.get("videolibrarypath", None) or \ self.settings_pre.get("folder_movies", None) != settings_post.get("folder_movies", None) or \ self.settings_pre.get("folder_tvshows", None) != settings_post.get("folder_tvshows", None): videolibrary.move_videolibrary( self.settings_pre.get("videolibrarypath", None), settings_post.get("videolibrarypath", None), self.settings_pre.get("folder_movies", None), settings_post.get("folder_movies", None), self.settings_pre.get("folder_tvshows", None), settings_post.get("folder_tvshows", None)) # si se ha puesto que se quiere autoconfigurar y se había creado el directorio de la videoteca if not self.settings_pre.get("videolibrary_kodi", None) and settings_post.get( "videolibrary_kodi", None): xbmc_videolibrary.ask_set_content(silent=True) elif self.settings_pre.get( "videolibrary_kodi", None) and not settings_post.get("videolibrary_kodi", None): xbmc_videolibrary.clean() if self.settings_pre.get('addon_update_timer') != settings_post.get( 'addon_update_timer'): schedule.clear('updater') self.scheduleUpdater() if self.update_setting != config.get_setting( "update", "videolibrary") or self.update_hour != config.get_setting( "everyday_delay", "videolibrary") * 4: schedule.clear('videolibrary') self.scheduleVideolibrary() if self.settings_pre.get('elementum_on_seed') != settings_post.get( 'elementum_on_seed') and settings_post.get( 'elementum_on_seed'): if not platformtools.dialog_yesno( config.get_localized_string(70805), config.get_localized_string(70806)): config.set_setting('elementum_on_seed', False) self.settings_pre = settings_post
def onSettingsChanged(self): logger.debug('settings changed') settings_post = config.get_all_settings_addon() if settings_post: # backup settings filetools.copy( os.path.join(config.get_data_path(), "settings.xml"), os.path.join(config.get_data_path(), "settings.bak"), True) logger.debug({ k: self.settings_pre[k] for k in self.settings_pre if k in settings_post and self.settings_pre[k] != settings_post[k] }) from platformcode import xbmc_videolibrary if self.settings_pre.get('downloadpath', None) != settings_post.get( 'downloadpath', None): xbmc_videolibrary.update_sources( settings_post.get('downloadpath', None), self.settings_pre.get('downloadpath', None)) # If the path of the video library has been changed, we call to check directories so that it creates it and automatically asks if to configure the video library if self.settings_pre.get("videolibrarypath", None) and self.settings_pre.get("videolibrarypath", None) != settings_post.get("videolibrarypath", None) or \ self.settings_pre.get("folder_movies", None) and self.settings_pre.get("folder_movies", None) != settings_post.get("folder_movies", None) or \ self.settings_pre.get("folder_tvshows", None) and self.settings_pre.get("folder_tvshows", None) != settings_post.get("folder_tvshows", None): videolibrary.move_videolibrary( self.settings_pre.get("videolibrarypath", ''), settings_post.get("videolibrarypath", ''), self.settings_pre.get("folder_movies", ''), settings_post.get("folder_movies", ''), self.settings_pre.get("folder_tvshows", ''), settings_post.get("folder_tvshows", '')) # if you want to autoconfigure and the video library directory had been created if not self.settings_pre.get("videolibrary_kodi", None) and settings_post.get( "videolibrary_kodi", None): xbmc_videolibrary.ask_set_content(silent=True) elif self.settings_pre.get( "videolibrary_kodi", None) and not settings_post.get("videolibrary_kodi", None): xbmc_videolibrary.clean() if self.settings_pre.get('addon_update_timer') != settings_post.get( 'addon_update_timer'): schedule.clear('updater') self.scheduleUpdater() if self.update_setting != config.get_setting( "update", "videolibrary") or self.update_hour != config.get_setting( "everyday_delay", "videolibrary") * 4: schedule.clear('videolibrary') self.scheduleVideolibrary() if self.settings_pre.get('elementum_on_seed') != settings_post.get( 'elementum_on_seed') and settings_post.get( 'elementum_on_seed'): if not platformtools.dialog_yesno( config.get_localized_string(70805), config.get_localized_string(70806)): config.set_setting('elementum_on_seed', False) self.settings_pre = settings_post
def open_settings(): settings_pre = get_all_settings_addon() __settings__.openSettings() settings_post = get_all_settings_addon() # cb_validate_config (util para validar cambios realizados en el cuadro de dialogo) if settings_post.get('adult_aux_intro_password', None): # Hemos accedido a la seccion de Canales para adultos from platformcode import platformtools if 'adult_password' not in settings_pre: adult_password = set_setting('adult_password', '0000') else: adult_password = settings_pre['adult_password'] if settings_post['adult_aux_intro_password'] == adult_password: # La contraseña de acceso es correcta # Cambio de contraseña if settings_post['adult_aux_new_password1']: if settings_post['adult_aux_new_password1'] == settings_post[ 'adult_aux_new_password2']: set_setting('adult_password', settings_post['adult_aux_new_password1']) else: platformtools.dialog_ok(get_localized_string(60305), get_localized_string(60306), get_localized_string(60307)) else: platformtools.dialog_ok(get_localized_string(60305), get_localized_string(60309), get_localized_string(60310)) # Deshacer cambios set_setting("adult_mode", settings_pre.get("adult_mode", 0)) set_setting("adult_request_password", settings_pre.get("adult_request_password", True)) # Borramos settings auxiliares set_setting('adult_aux_intro_password', '') set_setting('adult_aux_new_password1', '') set_setting('adult_aux_new_password2', '') from specials import videolibrary from platformcode import xbmc_videolibrary if settings_pre.get('downloadpath', None) != settings_post.get( 'downloadpath', None): xbmc_videolibrary.update_sources( settings_post.get('downloadpath', None), settings_pre.get('downloadpath', None)) # si se ha cambiado la ruta de la videoteca llamamos a comprobar directorios para que lo cree y pregunte # automaticamente si configurar la videoteca if settings_pre.get("videolibrarypath", None) != settings_post.get("videolibrarypath", None) or \ settings_pre.get("folder_movies", None) != settings_post.get("folder_movies", None) or \ settings_pre.get("folder_tvshows", None) != settings_post.get("folder_tvshows", None): videolibrary.move_videolibrary( settings_pre.get("videolibrarypath", None), settings_post.get("videolibrarypath", None), settings_pre.get("folder_movies", None), settings_post.get("folder_movies", None), settings_pre.get("folder_tvshows", None), settings_post.get("folder_tvshows", None)) # si se ha puesto que se quiere autoconfigurar y se había creado el directorio de la videoteca if not settings_pre.get("videolibrary_kodi", None) and settings_post.get( "videolibrary_kodi", None): xbmc_videolibrary.ask_set_content(silent=True) elif settings_pre.get("videolibrary_kodi", None) and not settings_post.get( "videolibrary_kodi", None): xbmc_videolibrary.clean_db()