From 7e8b4f952e1d9dd7fbbb58582324ff6ac177c83c Mon Sep 17 00:00:00 2001 From: wolfy Date: Thu, 31 Mar 2022 01:49:43 -0500 Subject: [PATCH] fixed numerous issues with the container and importing --- arm/__init__.py | 3 +++ arm/ripper/main.py | 8 ++++---- arm/runui.py | 10 ++++++---- arm/ui/__init__.py | 3 ++- arm/ui/routes.py | 4 +--- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/arm/__init__.py b/arm/__init__.py index e69de29bb..78a28e9f0 100755 --- a/arm/__init__.py +++ b/arm/__init__.py @@ -0,0 +1,3 @@ +import arm.config +import arm.ripper +import arm.ui diff --git a/arm/ripper/main.py b/arm/ripper/main.py index b5d6a47bf..2c4419449 100755 --- a/arm/ripper/main.py +++ b/arm/ripper/main.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 +import os import sys -sys.path.append("/opt/arm") +# set the PATH to /arm/arm so we can handle imports properly +sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..")) import argparse # noqa: E402 -import os # noqa: E402 import logging # noqa: E402 import time # noqa: E402 import datetime # noqa: E402 @@ -14,10 +15,9 @@ import pyudev # noqa: E402 import getpass # noqa E402 import psutil # noqa E402 -import arm.config.config as cfg +import arm.config.config as cfg # noqa E402 from arm.ripper import logger, utils, makemkv, handbrake, identify # noqa: E402 - from arm.ripper.getkeys import grabkeys # noqa: E402 from arm.models.models import Job, Config # noqa: E402 from arm.ui import app, db # noqa E402 diff --git a/arm/runui.py b/arm/runui.py index 3503d4bd0..363431592 100755 --- a/arm/runui.py +++ b/arm/runui.py @@ -1,12 +1,14 @@ -import os # noqa: F401 +import os import sys + +# set the PATH to /arm/arm so we can handle imports properly sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) +import arm.config.config as cfg # noqa E402 from arm.ui import app # noqa E402 -from arm.config.config import cfg # noqa E402 import arm.ui.routes # noqa E402 -host = arm_config['WEBSERVER_IP'] +host = cfg.arm_config['WEBSERVER_IP'] if host == 'x.x.x.x': # autodetect host IP address from netifaces import interfaces, ifaddresses, AF_INET @@ -23,5 +25,5 @@ host = '127.0.0.1' if __name__ == '__main__': - app.run(host=host, port=arm_config['WEBSERVER_PORT'], debug=True) + app.run(host=host, port=cfg.arm_config['WEBSERVER_PORT'], debug=True) # app.run(debug=True) diff --git a/arm/ui/__init__.py b/arm/ui/__init__.py index c1e3dc9e0..639b884d3 100755 --- a/arm/ui/__init__.py +++ b/arm/ui/__init__.py @@ -1,7 +1,6 @@ import sys # noqa: F401 import os # noqa: F401 import bcrypt # noqa: F401 -import arm.config.config as cfg from flask import Flask, logging, current_app # noqa: F401 from flask_sqlalchemy import SQLAlchemy @@ -13,6 +12,8 @@ from flask_login import LoginManager +import arm.config.config as cfg + sqlitefile = 'sqlite:///' + cfg.arm_config['DBFILE'] app = Flask(__name__) diff --git a/arm/ui/routes.py b/arm/ui/routes.py index 82bd82a3d..d2417d421 100755 --- a/arm/ui/routes.py +++ b/arm/ui/routes.py @@ -289,9 +289,7 @@ def settings(): This needs rewritten to be static """ x = "" - #arm_cfg_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..", "arm.yaml") comments = utils.generate_comments() - #arm_config = utils.get_settings(arm_cfg_file) form = SettingsForm() if form.validate_on_submit(): @@ -345,7 +343,7 @@ def settings(): flash("Setting saved successfully!", "success") return redirect(url_for('settings')) # If we get to here there was no post data - return render_template('settings.html', settings=cfg, form=form, raw=x, jsoncomments=comments) + return render_template('settings.html', settings=cfg.arm_config, form=form, raw=x, jsoncomments=comments) @app.route('/ui_settings', methods=['GET', 'POST'])