A bunch of work getting blueprints working
This commit is contained in:
parent
223a105be4
commit
d59e23fc4c
@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../../../static/style.css">
|
||||
<link rel="stylesheet" type="text/css" href="../static/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
@ -27,7 +27,7 @@
|
||||
<hr>
|
||||
<h3 class="text-center">Add Something</h3>
|
||||
<div class="row">
|
||||
<button class="col-sm-4 btn btn-secondary p-3 my-1">Upload a Static Image</button>
|
||||
<a class="col-sm-4 btn btn-secondary p-3 my-1" href="/upload/photo">Upload a Static Image</a>
|
||||
<button class="col-sm-4 btn btn-secondary p-3 my-1">Configure a Stream</button>
|
||||
<button class="col-sm-4 btn btn-secondary p-3 my-1">Upload a Slideshow of Images</button>
|
||||
</div>
|
||||
11
blueprints/home/home.py
Normal file
11
blueprints/home/home.py
Normal file
@ -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')
|
||||
15
blueprints/upload_photo/upload_photo.html
Normal file
15
blueprints/upload_photo/upload_photo.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Video Commander</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../static/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1 class="text-center">Upload a Static Photo</h1>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
11
blueprints/upload_photo/upload_photo.py
Normal file
11
blueprints/upload_photo/upload_photo.py
Normal file
@ -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')
|
||||
@ -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
|
||||
)
|
||||
|
||||
@ -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.route("/")
|
||||
def root_route():
|
||||
with open("./pages/home/resources/home.html", "r") as html_file:
|
||||
template = Template(html_file.read())
|
||||
|
||||
return template.render({}), 200
|
||||
app.register_blueprint(home_bp)
|
||||
app.register_blueprint(upload_photo_bp)
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True, host="0.0.0.0", port=2025)
|
||||
Loading…
Reference in New Issue
Block a user