def run(self, force_run): log.info("Checking version") # Wait for internet connection utils.wait_for_internet_connection() # Block version check (and update) in no force run mode when another process is using the wanted queue # We do not want to auto update the version while the application is busy with another process if not force_run and not utils.get_wanted_queue_lock(): return False # Check version self.manager.check_version(force_run) # Release wanted queue lock if not force_run: utils.release_wanted_queue_lock() # Only update and restart when: no force run, update is allowed and auto update is enabled if not force_run and self.manager.update_allowed and autosubliminal.CHECKVERSIONAUTOUPDATE: self.update() # Restart the app with exit of current process to have a clean restart scheduler.restart_app(exit=True) # Always return 'True' because we don't want to retry it until the next scheduled run return True
def save_and_restart_if_needed(return_tmpl_file): # Save to the configfile restart = config.write_config() # Check if restart is needed if restart: # Restart the runner in the background scheduler.restart_app() tmpl = Template(file="interface/templates/system/restart.tmpl") tmpl.message = "Saved config. Auto restart in progress..." return str(tmpl) else: # For some reason the config needs to be read again, otherwise all pages get an error config.read_config() utils.add_notification_message("Config saved") redirect_referer("/config")
def restart(self): scheduler.restart_app() tmpl = Template(file="interface/templates/system/restart.tmpl") tmpl.message = "Auto-Subliminal is restarting..." return str(tmpl)