def main(): # Coloca na agenda a rotina 1 - Carregamento e trabalhos schedule.every(1).day.do(loadTasks).run() # Carrega rotina principal na mermoria de exec worker_thread = threading.Thread(target=worker_main) worker_thread.start() while True: schedule.run_pending() time.sleep(1)
logger.debug('DPMS deactivated, re-scheduling screen-on jobs') self.scheduleScreenOnJobs() if __name__ == "__main__": logger.info('Starting KoD service') if config.get_setting('autostart'): xbmc.executebuiltin('RunAddon(plugin.video.' + config.PLUGIN_NAME + ')') # handling old autoexec method if config.is_autorun_enabled(): config.enable_disable_autorun(True) monitor = AddonMonitor() # mark as stopped all downloads (if we are here, probably kodi just started) from specials.downloads import stop_all try: stop_all() except: logger.error(traceback.format_exc()) while True: try: schedule.run_pending() except: logger.error(traceback.format_exc()) if monitor.waitForAbort(1): # every second break