From d59e23fc4c9bd448bab7c39162159727abc53a2d Mon Sep 17 00:00:00 2001 From: Bradley Bickford Date: Sun, 26 Oct 2025 19:21:00 -0400 Subject: [PATCH] A bunch of work getting blueprints working --- {pages/home => blueprints}/__init__.py | 0 .../resources => blueprints/home}/home.html | 4 ++-- blueprints/home/home.py | 11 +++++++++++ blueprints/upload_photo/upload_photo.html | 15 +++++++++++++++ blueprints/upload_photo/upload_photo.py | 11 +++++++++++ sc_database_generator.py | 6 ++++-- sc_webserver.py | 12 ++++-------- scdb.db | Bin 0 -> 24576 bytes testdb.db | Bin 12288 -> 0 bytes 9 files changed, 47 insertions(+), 12 deletions(-) rename {pages/home => blueprints}/__init__.py (100%) rename {pages/home/resources => blueprints/home}/home.html (91%) create mode 100644 blueprints/home/home.py create mode 100644 blueprints/upload_photo/upload_photo.html create mode 100644 blueprints/upload_photo/upload_photo.py create mode 100644 scdb.db delete mode 100644 testdb.db 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 0000000000000000000000000000000000000000..2f3b37e00813e342b487169394bc2699ccefd3c7 GIT binary patch literal 24576 zcmeI#O>f#T7zgmAj(BG0p5t1mbw|eY8s*dcm9y15po~Xx$Ot84n@AUVjR@ETqEBJBJIG*Iri@yC5|KaO#Ry#XW zf7%kh<1&Z3RGOsmg;YWTr1*^zNMrx22=XI5LEZf>$#;Y@>*{i}vE!EsuE{!AH#OFmcD2Wk$u0UT(3z8b_I6d9~*S_Qpeh|7dz_JYiOst(_jP z6nAYfXVDQW`gi81_i9$tG<8;wC(V4F9#l>HP00bZa0SG_<0uX=z1Rwwb2rLD#|Ho8-00bZa0SG_< z0uX=z1Rwwb2pqlu_Wy@pWBfx1KmY;|fB*y_009U<00Izz0QUcw0}y}!1Rwwb2tWV= O5P$##AOL~G7x)YAivXkm literal 0 HcmV?d00001 diff --git a/testdb.db b/testdb.db deleted file mode 100644 index 9ed119504c0e1e70c42792ed4ca928d26636a018..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI&!A`PC0SG_<0uX=z1Rwwb2tWV=5ZGyfmbRBGm1H;e?*}Rx54dga zMQZ$}!iVjtUUen`0SG_<0uX=z1Rwwb2tWV=5P-l=2^?s;IBAEY8MTxj@vEJc+Oc|lRv}&c zvzH+3^V)H?I+}!>>}QjzL#d0?+C*_pMfqWre4CfXiu->~5D1Rwwb2tWV=5P$## TAOHaf{0jl@|MPP5A3^F9dp>J2