Some more stuff sort of working, started slideshow stuff
This commit is contained in:
34
blueprints/configure_stream/configure_stream.html
Normal file
34
blueprints/configure_stream/configure_stream.html
Normal file
@@ -0,0 +1,34 @@
|
||||
<!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">Configure a Remote Stream</h1>
|
||||
<hr>
|
||||
<div class="alert alert-info text-center" role="alert">
|
||||
Configure a stream, content that is played from a location on the local network or the Internet.
|
||||
</div>
|
||||
<form action="/configure/stream" method="POST">
|
||||
<div class="form-group">
|
||||
<label for="buttonName">Button Name</label>
|
||||
<input type="text" class="form-control" name="buttonName" id="buttonName" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="streamURL">Stream URL</label>
|
||||
<input type="text" class="form-control" name="streamURL" id="streamURL" />
|
||||
</div>
|
||||
<div class="form-check form-switch form-check-input-lg">
|
||||
<input type="checkbox" class="form-check-input" name="fullScreen" id="fullScreen" checked/>
|
||||
<label for="fullScreen" class="form-check-label">Play the stream in Full Screen?</label>
|
||||
</div>
|
||||
<button id="submit" class="btn btn-primary form-control" type="submit">Submit</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
33
blueprints/configure_stream/configure_stream.py
Normal file
33
blueprints/configure_stream/configure_stream.py
Normal file
@@ -0,0 +1,33 @@
|
||||
from flask import Blueprint, request, render_template, redirect
|
||||
from utilities.tools import get_db
|
||||
|
||||
configure_stream_bp = Blueprint('configure_stream', __name__, url_prefix='/configure', template_folder='.')
|
||||
|
||||
@configure_stream_bp.route('/stream', methods=['GET', 'POST'])
|
||||
def get_page():
|
||||
if request.method == "GET":
|
||||
return render_get()
|
||||
elif request.method == "POST":
|
||||
return upload()
|
||||
|
||||
|
||||
def render_get():
|
||||
return render_template('configure_stream.html'), 200
|
||||
|
||||
def upload():
|
||||
# TODO Input Validation
|
||||
|
||||
new_id = get_db().insert(
|
||||
"media",
|
||||
["media_name", "media_uri"],
|
||||
[request.form["buttonName"], request.form["streamURL"]]
|
||||
)
|
||||
|
||||
if request.form.get("fullScreen", False):
|
||||
get_db().insert(
|
||||
"media_playback_option",
|
||||
["media_id", "media_playback_option", "media_playback_option_weight"],
|
||||
[new_id, "-fs", 1]
|
||||
)
|
||||
|
||||
return redirect("/")
|
||||
Reference in New Issue
Block a user