diff --git a/aura.py b/aura.py index 341fdc65e056e6ac337ca280e93f2a384dac2db2..691d38aa052e1ffdc77562294813060082f5af05 100755 --- a/aura.py +++ b/aura.py @@ -27,25 +27,33 @@ import signal import logging import unittest -from pathlib import Path -from flask import request, render_template, Flask, Response +from flask import Flask from flask_sqlalchemy import SQLAlchemy from sqlalchemy.ext.declarative import declarative_base + from libraries.base.logger import AuraLogger from libraries.base.config import AuraConfig # from modules.monitoring.diskspace_watcher import DiskSpaceWatcher + +config = AuraConfig() def configure_flask(): app.config["SQLALCHEMY_DATABASE_URI"] = config.get_database_uri() app.config['BABEL_DEFAULT_LOCALE'] = 'de' app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False -config = AuraConfig() + +# FIXME Instatiate SQLAlchemy without the need for Flask app = Flask(__name__) configure_flask() DB = SQLAlchemy(app) Base = declarative_base() class Aura: + """ + Aura Class + + The core of Aura Engine. + """ logger = None config = None server = None @@ -53,13 +61,20 @@ class Aura: controller = None scheduler = None - # ------------------------------------------------------------------------------------------ # + def __init__(self): + """ + Initializes the Engine Core. + """ self.config = config AuraLogger(self.config) self.logger = logging.getLogger("AuraEngine") + def startup(self): + """ + Starts the Engine Core. + """ from modules.scheduling.scheduler import AuraScheduler from modules.communication.liquidsoap.communicator import LiquidSoapCommunicator from modules.communication.redis.adapter import ServerRedisAdapter @@ -90,10 +105,12 @@ class Aura: -# # ## ## ## ## ## # # -# # ENTRY FUNCTION # # -# # ## ## ## ## ## # # -def main(): +# +# START THE ENGINE +# + + +if __name__ == "__main__": aura = Aura() if len(sys.argv) >= 2: @@ -103,12 +120,3 @@ def main(): aura.config.set("recreate_db", True) aura.startup() - - -# # ## ## ## ## ## ## # # -# # End ENTRY FUNCTION # # -# # ## ## ## ## ## ## # # - - -if __name__ == "__main__": - main()