diff --git a/pages/home/__init__.py b/blueprints/__init__.py similarity index 100% rename from pages/home/__init__.py rename to blueprints/__init__.py diff --git a/pages/home/resources/home.html b/blueprints/home/home.html similarity index 91% rename from pages/home/resources/home.html rename to blueprints/home/home.html index 413c28a..5a18cfb 100644 --- a/pages/home/resources/home.html +++ b/blueprints/home/home.html @@ -5,7 +5,7 @@ - +
@@ -27,7 +27,7 @@

Add Something

- + Upload a Static Image
diff --git a/blueprints/home/home.py b/blueprints/home/home.py new file mode 100644 index 0000000..b43a233 --- /dev/null +++ b/blueprints/home/home.py @@ -0,0 +1,11 @@ +from flask import Blueprint, request, render_template + +home_bp = Blueprint('home', __name__, template_folder='.') + +@home_bp.route("/") +def root_route(): + if request.method == "GET": + return render_get(), 200 + +def render_get(): + return render_template('home.html') \ No newline at end of file diff --git a/blueprints/upload_photo/upload_photo.html b/blueprints/upload_photo/upload_photo.html new file mode 100644 index 0000000..9352ac2 --- /dev/null +++ b/blueprints/upload_photo/upload_photo.html @@ -0,0 +1,15 @@ + + + + Video Commander + + + + + + +
+

Upload a Static Photo

+
+ + \ No newline at end of file diff --git a/blueprints/upload_photo/upload_photo.py b/blueprints/upload_photo/upload_photo.py new file mode 100644 index 0000000..0445998 --- /dev/null +++ b/blueprints/upload_photo/upload_photo.py @@ -0,0 +1,11 @@ +from flask import Blueprint, request, render_template + +upload_photo_bp = Blueprint('upload_photo', __name__, url_prefix='/upload', template_folder='.') + +@upload_photo_bp.route('/photo') +def get_page(): + if request.method == "GET": + return render_get(), 200 + +def render_get(): + return render_template('upload_photo.html') \ No newline at end of file diff --git a/sc_database_generator.py b/sc_database_generator.py index f715e7d..c5c2486 100644 --- a/sc_database_generator.py +++ b/sc_database_generator.py @@ -2,7 +2,7 @@ import json from utilities.database.sqlite import SQLite with open("config.json", 'r') as config_file: - config_json = json.load(config_file.read()) + config_json = json.loads(config_file.read()) my_db = SQLite(config_json["database"]["name"]) @@ -12,7 +12,8 @@ my_db.query(""" media_name TEXT NOT NULL, media_uri TEXT, media_preparing INTEGER DEFAULT 0 CHECK(media_preparing IN (0, 1)), - media_active INTEGER DEFAULT 0 CHECK(media_active IN (0, 1)) + media_active INTEGER DEFAULT 0 CHECK(media_active IN (0, 1)), + media_default INTEGER DEFAULT 0 CHECK(media_default IN (0, 1)) ) """) @@ -21,6 +22,7 @@ my_db.query(""" media_preparation_id INTEGER PRIMARY KEY AUTOINCREMENT, media_id INTEGER NOT NULL, media_preparation_started INTEGER DEFAULT 0 CHECK(media_preparation_started IN (0, 1)), + media_preparation_progress INTEGER, media_preparation_finished INTEGER DEFAULT 0 CHECK(media_preparation_finished IN (0, 1)), media_preparation_time_between_components INTEGER ) diff --git a/sc_webserver.py b/sc_webserver.py index 28a2b69..3ae5deb 100644 --- a/sc_webserver.py +++ b/sc_webserver.py @@ -1,14 +1,10 @@ from flask import Flask -from jinja2 import Template +from blueprints.home.home import home_bp +from blueprints.upload_photo.upload_photo import upload_photo_bp app = Flask(__name__) +app.register_blueprint(home_bp) +app.register_blueprint(upload_photo_bp) -@app.route("/") -def root_route(): - with open("./pages/home/resources/home.html", "r") as html_file: - template = Template(html_file.read()) - - return template.render({}), 200 - if __name__ == '__main__': app.run(debug=True, host="0.0.0.0", port=2025) \ No newline at end of file diff --git a/scdb.db b/scdb.db new file mode 100644 index 0000000..2f3b37e Binary files /dev/null and b/scdb.db differ diff --git a/testdb.db b/testdb.db deleted file mode 100644 index 9ed1195..0000000 Binary files a/testdb.db and /dev/null differ