def get_application(self): global to_reload if to_reload: self.app = self.create_app() to_reload = False cfg.load_config() return self.app
# built from example in: # https://pypi.org/project/timeloop/ # https://medium.com/greedygame-engineering/an-elegant-way-to-run-periodic-tasks-in-python-61b7c477b679 import time import logging import os from timeloop import Timeloop from datetime import timedelta # Running as standalone or part of the application if __name__ == '__main__' or __name__ == 'timeloop_module': import app_config as cfg from loggerinitializer import initialize_logger import csv_module as fc cfg.load_config() else: import engine.app_config as cfg from engine.loggerinitializer import initialize_logger import engine.csv_module as fc initialize_logger(cfg._logPath) tl = Timeloop() @tl.job(interval=timedelta(seconds=cfg._jobInterval)) def copy_job(): logging.info("Auto job running every {} seconds".format(cfg._jobInterval)) logging.info("Auto job current time : {}".format(time.ctime())) fc.copy_job() notification()
def reload(): global to_reload to_reload = True cfg.load_config() flash('Reloading completed', 'info') return 'reloaded'
pass def show(self): pass class MainMenu: def __init__(self, spotify, charts_items): self.charts_items = charts_items self.sp = spotify def show(self): pass def spotify_find(self): pass if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s') config = app_config.load_config(load_defaults=True) spotipy_wrapper_handle = pre_gui() launcher = GuiLauncher() launcher.spotify = spotipy_wrapper_handle Screen.wrapper(launcher.go) app_config.save_config(config, skip_write=False)