From 82f4dd3865a642b5caddba66980907263c0a02e5 Mon Sep 17 00:00:00 2001
From: David Trattnig <david.trattnig@o94.at>
Date: Mon, 2 Mar 2020 17:04:11 +0100
Subject: [PATCH] Remove more Flask dependencies.

---
 aura.py | 42 +++++++++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/aura.py b/aura.py
index 341fdc65..691d38aa 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()
-- 
GitLab