video management #11

Merged
Jan merged 2 commits from working into main 2024-10-13 16:14:09 +02:00
3 changed files with 81 additions and 1 deletions

2
.gitignore vendored
View File

@ -3,7 +3,7 @@
*.pyc *.pyc
__pycache__/ __pycache__/
instance/
uploads/ uploads/
zip_exports/ zip_exports/

View File

@ -616,6 +616,34 @@ def show_tables():
tables = meta.tables tables = meta.tables
return render_template('show_tables.html', tables=tables) return render_template('show_tables.html', tables=tables)
@app.route("/manage_uploads")
def manage_uploads():
if not session.get("logged_in"):
return redirect("/login")
videodir = "uploads/"
videolist = os.listdir(videodir)
num_videos = len(videolist)
return render_template("manage_uploads.html", videolist=videolist, num_videos=num_videos)
@app.route("/deleteuploads", methods=["POST"])
def deleteuploads():
if not session.get("logged_in"):
return redirect("/login")
print("deleting all videos")
videodir = "uploads/"
for video in os.listdir(videodir):
os.remove(os.path.join(videodir, video))
print("videos deleted")
return redirect("/all_links")
# Root page ----------------------------- # Root page -----------------------------

View File

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css')}}"" /> <!-- styles.css {{ url_for('static', filename='styles.css')}}-->
<link rel=" shortcut icon" href="{{ url_for('static', filename='icons/favicon.ico') }}">
<title>DGS Avatar Study</title>
</head>
<body>
<div class="container" style="height: 100%; font-size: 22px;">
<h2>Upload management</h2>
<div class="textblock">
<p>
Anzahl Videos: {{ num_videos }}
</p>
<p>
Die aktuellen Videos:
</p>
</div>
{% for video in videolist %}
<p>{{video}}</p>
{% endfor %}
<div class="textblock">
<p>
Download <a href="{{ url_for('export_all_videos') }}" target="_blank">hier</a>.
</p>
</div>
<form class="dsgvoform" action="{{ url_for('deleteuploads') }}" method="post">
<label for="terms-and-conditions">
<input class="inline" id="terms-and-conditions" type="checkbox" required name="terms-and-conditions" />
Alle Videos löschen.
</label>
<div class="button-container">
<button id="submitbutton" type="submit">Löschen</button>
</div>
</form>
<div class="spacer" aria-hidden="true" style="height:50px"></div>
</div>
</body>
<footer>
<div class="container" style="font-size: 19px;">
<a href="{{ url_for('startpage') }}" target="_blank">Startseite</a>
<a href="{{ url_for('impressum') }}" target="_blank">Impressum</a>
<a href="{{ url_for('datenschutz') }}" target="_blank">Datenschutz</a>
</div>
</footer>
</html>