Merge pull request 'video management' (#11) from working into main
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #11
This commit is contained in:
commit
df80e62707
2
.gitignore
vendored
2
.gitignore
vendored
@ -3,7 +3,7 @@
|
||||
*.pyc
|
||||
__pycache__/
|
||||
|
||||
|
||||
instance/
|
||||
|
||||
uploads/
|
||||
zip_exports/
|
||||
|
@ -616,6 +616,34 @@ def show_tables():
|
||||
tables = meta.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 -----------------------------
|
||||
|
||||
|
52
slaeforms/templates/manage_uploads.html
Normal file
52
slaeforms/templates/manage_uploads.html
Normal 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>
|
Loading…
Reference in New Issue
Block a user