diff --git a/data/results.json b/data/results.json deleted file mode 100644 index 3978ebd..0000000 --- a/data/results.json +++ /dev/null @@ -1,28 +0,0 @@ -[ - { - "name": "r", - "guesses": [ - { - "song_id": "001", - "right": true - }, - { - "song_id": "002", - "right": false - } - ] - }, - { - "name": "Robin", - "guesses": [ - { - "song_id": "001", - "right": false - }, - { - "song_id": "002", - "right": false - } - ] - } -] \ No newline at end of file diff --git a/data/songs.json b/data/songs.json index 802c9d6..1ae7b45 100644 --- a/data/songs.json +++ b/data/songs.json @@ -1,20 +1,142 @@ [ - { - "name": "Umsonst gelebt", - "artist": "Jugend Chor", - "id": "002", - "original_name": "-", - "original": { - "filename": "m003", - "sampling_rate": 44.1, - "bitrate": 256 - }, - "edits": [ - { - "filename": "m004", - "sampling_rate": 22.1, - "bitrate": 63 - } - ] - } + { + "name": "Umsonst gelebt", + "artist": "Jugend Chor", + "original": { + "filename": "8101b201694b47fe88d3764e66d8894e.mp3", + "sampling_rate": 44100, + "bitrate": 256000, + "size": 7037136 + }, + "edits": [ + { + "id": "55fa1a2bf70e4c3297e1c7070389276d", + "filename": "55fa1a2bf70e4c3297e1c7070389276d.mp3", + "mode": "vbr", + "quality": 6, + "bitrate": 65146, + "sampling_rate": 22050, + "size": 1780043 + }, + { + "id": "05cc0367e7af4977ac1f79d816e9f164", + "filename": "05cc0367e7af4977ac1f79d816e9f164.mp3", + "mode": "cbr", + "quality": null, + "bitrate": 64000, + "sampling_rate": 8000, + "size": 1750133 + } + ], + "id": "001" + }, + { + "name": "Meinem Jesus will ich weihen", + "artist": "Jungscharchor", + "original": { + "filename": "27894cac76974fb58fdeb5a8fa639605.mp3", + "sampling_rate": 44100, + "bitrate": 128000, + "size": 1810393 + }, + "edits": [ + { + "id": "2c06e685fb224f629d7a20d31ec5e6d9", + "filename": "2c06e685fb224f629d7a20d31ec5e6d9.mp3", + "mode": "vbr", + "quality": 9, + "bitrate": 30101, + "sampling_rate": 22050, + "size": 417068 + } + ], + "id": "002" + }, + { + "name": "Ich glaube an Jesus", + "artist": "Gruppe", + "original": { + "filename": "c9bf5b8afe124b949f09211359b8ff5b.mp3", + "sampling_rate": 44100, + "bitrate": 128000, + "size": 3432051 + }, + "edits": [ + { + "id": "52f737589f4b461eaf7b0a3273921613", + "filename": "52f737589f4b461eaf7b0a3273921613.mp3", + "mode": "vbr", + "quality": 4, + "bitrate": 55191, + "sampling_rate": 22050, + "size": 1465187 + } + ], + "id": "003" + }, + { + "name": "Bin erlöst von aller Sünd", + "artist": "Jungscharchor", + "original": { + "filename": "5a94207c76b343b8b802b6c2894c69fa.mp3", + "sampling_rate": 44100, + "bitrate": 128000, + "size": 2686933 + }, + "edits": [ + { + "id": "7822fb105be341c9b169ef7ace84aeb8", + "filename": "7822fb105be341c9b169ef7ace84aeb8.mp3", + "mode": "vbr", + "quality": 9, + "bitrate": 43628, + "sampling_rate": 44100, + "size": 903637 + } + ], + "id": "004" + }, + { + "name": "Du bist nah mir wie das Meer dem Strande", + "artist": "Jungscharlehrer", + "original": { + "filename": "380549bd1fb84a728d0068e42043f074.mp3", + "sampling_rate": 44100, + "bitrate": 128000, + "size": 2466338 + }, + "edits": [ + { + "id": "d6a8f772629b43ecb5a9b03a6dea010c", + "filename": "d6a8f772629b43ecb5a9b03a6dea010c.mp3", + "mode": "vbr", + "quality": 2, + "bitrate": 67476, + "sampling_rate": 22050, + "size": 1280972 + } + ], + "id": "005" + }, + { + "name": "Zeugnis", + "original": { + "filename": "9a534ade55264c16a392c48dc14aedcc.mp3", + "sampling_rate": 44100, + "bitrate": 128000, + "size": 12757866 + }, + "edits": [ + { + "id": "fd6ed7f4a2c64a498ff64beaf19eacc2", + "filename": "fd6ed7f4a2c64a498ff64beaf19eacc2.mp3", + "mode": "cbr", + "quality": null, + "bitrate": 32000, + "sampling_rate": 8000, + "size": 3187229 + } + ], + "id": "006" + } ] \ No newline at end of file diff --git a/main.py b/main.py index 2ff110d..87cf0fb 100644 --- a/main.py +++ b/main.py @@ -8,6 +8,7 @@ load_dotenv() app = Flask(__name__) app.secret_key = os.environ["SECRET_KEY"] +app.config["MAX_CONTENT_LENGTH"] = 50 * 1024 * 1024 # 50 MB app.register_blueprint(bp) if __name__ == "__main__": diff --git a/routes.py b/routes.py index 4bccc8c..8bb978a 100644 --- a/routes.py +++ b/routes.py @@ -1,5 +1,6 @@ from flask import Blueprint, render_template, request, redirect, url_for, session, jsonify, Response, current_app, abort import json +from werkzeug.utils import secure_filename from pathlib import Path import random import csv @@ -7,9 +8,14 @@ import hmac import io import os import time +import re +import uuid from functools import wraps from db import init_db, get_db, close_db, create_participant, now from datetime import datetime, timezone +import threading +from mutagen import File +import subprocess bp = Blueprint("main", __name__) @@ -19,11 +25,40 @@ bp.teardown_app_request(close_db) BASE_DIR = Path(__file__).parent BASE_MUSIC_DIR = BASE_DIR / "static" / "data" / "music" BASE_MUSIC_FILENAME_DIR = "data/music/" +SONGS_PATH = BASE_DIR / "data" / "songs.json" +_songs_lock = threading.Lock() def load_songs_list(): - with open(BASE_DIR / "data" / "songs.json", encoding="utf-8") as f: + with open(SONGS_PATH, encoding="utf-8") as f: return json.load(f) +def save_songs_list(songs): + tmp = SONGS_PATH.with_suffix(".json.tmp") + with open(tmp, "w", encoding="utf-8") as f: + json.dump(songs, f, ensure_ascii=False, indent=2) + os.replace(tmp, SONGS_PATH) # atomar ersetzen + +def next_song_id(songs, prefix="", width=3): + nums = [] + for s in songs: + m = re.fullmatch(rf"{prefix}(\d+)", str(s["id"])) + if m: + nums.append(int(m.group(1))) + return f"{prefix}{max(nums, default=0) + 1:0{width}d}" + +def add_song(song): + with _songs_lock: + songs = load_songs_list() + song["id"] = next_song_id(songs) + songs.append(song) + save_songs_list(songs) + return song + +ALLOWED_EXTENSIONS = {"mp3", "wav", "flac", "ogg", "m4a"} + +def allowed_file(filename): + return "." in filename and filename.rsplit(".", 1)[1].lower() in ALLOWED_EXTENSIONS + def session_required(api=False, participant=True): """Prüft Datenschutz-Zustimmung und (optional) angelegten Teilnehmer. @@ -102,8 +137,8 @@ def api_getRandomSong(): truth = random.choice(["a", "b"]) session["current"] = {"id": song["id"], "truth": truth} - truth_path = BASE_MUSIC_FILENAME_DIR + song["original"]["filename"] + ".mp3" - random_lie_path = BASE_MUSIC_FILENAME_DIR + random.choice(song["edits"])["filename"] + ".mp3" + truth_path = BASE_MUSIC_FILENAME_DIR + song["original"]["filename"] + random_lie_path = BASE_MUSIC_FILENAME_DIR + random.choice(song["edits"])["filename"] if truth == "a": path_a = truth_path @@ -193,42 +228,7 @@ CHOICE_LABELS = {"a": "A", "b": "B", "non": "Kein Unterschied"} @bp.route("/admin") @admin_required def admin(): - db = get_db() - songs = {s["id"]: s["name"] for s in load_songs_list()} - - by_person = {} - for r in db.execute("SELECT * FROM ratings ORDER BY id"): - by_person.setdefault(r["participant_id"], []).append({ - "song_id": r["song_id"], - "right": bool(r["original_chosen"]), - "choice": CHOICE_LABELS.get(r["choice"], r["choice"]), - "edit": r["edit"] or "–", - }) - - rows = [] - for p in db.execute("SELECT id, name, created FROM participants ORDER BY created DESC"): - guesses = by_person.get(p["id"], []) - if not guesses: - continue # nur Teilnehmer mit mindestens einer Bewertung - total = len(guesses) - right = sum(g["right"] for g in guesses) - rows.append({ - "name": p["name"], - "started": p["created"], - "total": total, - "right": right, - "quote": round(100 * right / total), - "guesses": guesses, - }) - - total_all = sum(r["total"] for r in rows) - right_all = sum(r["right"] for r in rows) - stats = { - "people": len(rows), - "guesses": total_all, - "quote": round(100 * right_all / total_all) if total_all else None, - } - return render_template("admin.html", rows=rows, stats=stats, songs=songs) + return render_template("admin.html") def csv_safe(value): @@ -270,4 +270,178 @@ def debug_reset(): if not current_app.debug: abort(404) # im normalen Betrieb existiert die Route praktisch nicht session.clear() - return redirect(url_for("main.login")) \ No newline at end of file + return redirect(url_for("main.login")) + +@bp.route("/admin/add") +@admin_required +def admin_add(): + return render_template("admin_add.html") + +@bp.route("/admin/results") +@admin_required +def admin_results(): + db = get_db() + songs = {s["id"]: s["name"] for s in load_songs_list()} + + by_person = {} + for r in db.execute("SELECT * FROM ratings ORDER BY id"): + by_person.setdefault(r["participant_id"], []).append({ + "song_id": r["song_id"], + "right": bool(r["original_chosen"]), + "choice": CHOICE_LABELS.get(r["choice"], r["choice"]), + "edit": r["edit"] or "–", + }) + + rows = [] + for p in db.execute("SELECT id, name, created FROM participants ORDER BY created DESC"): + guesses = by_person.get(p["id"], []) + if not guesses: + continue # nur Teilnehmer mit mindestens einer Bewertung + total = len(guesses) + right = sum(g["right"] for g in guesses) + rows.append({ + "name": p["name"], + "started": p["created"], + "total": total, + "right": right, + "quote": round(100 * right / total), + "guesses": guesses, + }) + + total_all = sum(r["total"] for r in rows) + right_all = sum(r["right"] for r in rows) + stats = { + "people": len(rows), + "guesses": total_all, + "quote": round(100 * right_all / total_all) if total_all else None, + } + return render_template("admin_results.html", rows=rows, stats=stats, songs=songs) + +@bp.route("/admin/list") +@admin_required +def admin_list(): + songs = load_songs_list() + return render_template("admin_tasksList.html", songs=songs) + +@bp.route("/admin/add/") +@admin_required +def admin_add_task(songId): + song = False + for s in load_songs_list(): + if s["id"] == songId: + song = s + if not song: + return 404 + return render_template("admin_add_task.html", song=song) + +@bp.route("/api/admin/add", methods=["POST"]) +@admin_required +def api_admin_add(): + title = request.form.get("title", "").strip() + file = request.files.get("file") + + if not title: + return jsonify({"saved": False, "error": "Titel fehlt"}), 400 + if not file or file.filename == "": + return jsonify({"saved": False, "error": "Keine Datei"}), 400 + if not allowed_file(file.filename): + return jsonify({"saved": False, "error": "Dateityp nicht erlaubt"}), 400 + + ext = os.path.splitext(secure_filename(file.filename))[1].lower() + filename_new = uuid.uuid4().hex + ext + + BASE_MUSIC_DIR.mkdir(parents=True, exist_ok=True) + path = BASE_MUSIC_DIR / filename_new + file.save(path) + + # read bitrate and sampling rate + audio = File(path) + + #stem = os.path.splitext(filename_new)[0] + song = add_song({ + "name": title, + "original": { + "filename": filename_new, + "sampling_rate": audio.info.sample_rate, + "bitrate": audio.info.bitrate, + "size": path.stat().st_size, # Bytes + }, + "edits": [], + }) + + return jsonify({"saved": True, "filename": filename_new}) + +VALID_SAMPLING_RATES = {8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000} + +@bp.route("/api/admin/add/", methods=["POST"]) +@admin_required +def api_admin_add_task(songId): + mode = request.form.get("mode", "cbr") + sampling_rate = request.form.get("sampling_rate", type=int) + + if mode not in ("cbr", "vbr"): + return jsonify({"saved": False, "error": "Ungültiger Modus"}), 400 + if sampling_rate not in VALID_SAMPLING_RATES: + return jsonify({"saved": False, "error": "Ungültige Abtastrate"}), 400 + + songs = load_songs_list() + song = next((s for s in songs if str(s["id"]) == songId), None) + if song is None: + return jsonify({"saved": False, "error": "Song nicht gefunden"}), 404 + + original = song["original"] + if sampling_rate > original["sampling_rate"]: + return jsonify({"saved": False, "error": "Abtastrate höher als Original"}), 400 + + if mode == "vbr": + quality = request.form.get("quality", type=int) + if quality is None or not 0 <= quality <= 9: + return jsonify({"saved": False, "error": "Ungültige VBR-Qualität"}), 400 + quality_args = ["-q:a", str(quality)] + else: + bitrate_kbps = request.form.get("bitrate", type=int) + if not bitrate_kbps or bitrate_kbps <= 0: + return jsonify({"saved": False, "error": "Bitrate fehlt"}), 400 + if bitrate_kbps * 1000 > original["bitrate"] + 1000: + return jsonify({"saved": False, "error": "Bitrate höher als Original"}), 400 + quality_args = ["-b:a", f"{bitrate_kbps}k"] + + src = BASE_MUSIC_DIR / original["filename"] + if not src.is_file(): + return jsonify({"saved": False, "error": "Originaldatei fehlt"}), 404 + + edit_id = uuid.uuid4().hex + dst = BASE_MUSIC_DIR / (edit_id + ".mp3") # immer MP3, siehe Hinweis unten + + try: + subprocess.run( + ["ffmpeg", "-y", "-i", str(src), "-vn", + "-c:a", "libmp3lame", *quality_args, + "-ar", str(sampling_rate), str(dst)], + check=True, capture_output=True, timeout=300, + ) + except subprocess.CalledProcessError as e: + dst.unlink(missing_ok=True) + current_app.logger.error("ffmpeg: %s", e.stderr.decode(errors="replace")[-1000:]) + return jsonify({"saved": False, "error": "Konvertierung fehlgeschlagen"}), 500 + except subprocess.TimeoutExpired: + dst.unlink(missing_ok=True) + return jsonify({"saved": False, "error": "Zeitüberschreitung"}), 500 + + # tatsächliche Werte aus der fertigen Datei lesen + out = File(dst) + actual_bitrate = out.info.bitrate if out else None + actual_rate = out.info.sample_rate if out else sampling_rate + + song.setdefault("edits", []).append({ + "id": edit_id, + "filename": dst.name, + "mode": mode, + "quality": quality if mode == "vbr" else None, + "bitrate": actual_bitrate, + "sampling_rate": actual_rate, + "size": dst.stat().st_size, # Bytes + }) + save_songs_list(songs) + + return jsonify({"saved": True, "id": edit_id}) \ No newline at end of file diff --git a/static/data/music/03f6804255504d1dadd4f1193b9b2acc.mp3 b/static/data/music/03f6804255504d1dadd4f1193b9b2acc.mp3 new file mode 100644 index 0000000..0d1f6eb Binary files /dev/null and b/static/data/music/03f6804255504d1dadd4f1193b9b2acc.mp3 differ diff --git a/static/data/music/05cc0367e7af4977ac1f79d816e9f164.mp3 b/static/data/music/05cc0367e7af4977ac1f79d816e9f164.mp3 new file mode 100644 index 0000000..1122abd Binary files /dev/null and b/static/data/music/05cc0367e7af4977ac1f79d816e9f164.mp3 differ diff --git a/static/data/music/27894cac76974fb58fdeb5a8fa639605.mp3 b/static/data/music/27894cac76974fb58fdeb5a8fa639605.mp3 new file mode 100644 index 0000000..5b10535 Binary files /dev/null and b/static/data/music/27894cac76974fb58fdeb5a8fa639605.mp3 differ diff --git a/static/data/music/2c06e685fb224f629d7a20d31ec5e6d9.mp3 b/static/data/music/2c06e685fb224f629d7a20d31ec5e6d9.mp3 new file mode 100644 index 0000000..170742e Binary files /dev/null and b/static/data/music/2c06e685fb224f629d7a20d31ec5e6d9.mp3 differ diff --git a/static/data/music/380549bd1fb84a728d0068e42043f074.mp3 b/static/data/music/380549bd1fb84a728d0068e42043f074.mp3 new file mode 100644 index 0000000..c63ab0a Binary files /dev/null and b/static/data/music/380549bd1fb84a728d0068e42043f074.mp3 differ diff --git a/static/data/music/52f737589f4b461eaf7b0a3273921613.mp3 b/static/data/music/52f737589f4b461eaf7b0a3273921613.mp3 new file mode 100644 index 0000000..58560b3 Binary files /dev/null and b/static/data/music/52f737589f4b461eaf7b0a3273921613.mp3 differ diff --git a/static/data/music/55fa1a2bf70e4c3297e1c7070389276d.mp3 b/static/data/music/55fa1a2bf70e4c3297e1c7070389276d.mp3 new file mode 100644 index 0000000..67b20cc Binary files /dev/null and b/static/data/music/55fa1a2bf70e4c3297e1c7070389276d.mp3 differ diff --git a/static/data/music/5a94207c76b343b8b802b6c2894c69fa.mp3 b/static/data/music/5a94207c76b343b8b802b6c2894c69fa.mp3 new file mode 100644 index 0000000..1389494 Binary files /dev/null and b/static/data/music/5a94207c76b343b8b802b6c2894c69fa.mp3 differ diff --git a/static/data/music/7822fb105be341c9b169ef7ace84aeb8.mp3 b/static/data/music/7822fb105be341c9b169ef7ace84aeb8.mp3 new file mode 100644 index 0000000..c53bd91 Binary files /dev/null and b/static/data/music/7822fb105be341c9b169ef7ace84aeb8.mp3 differ diff --git a/static/data/music/8101b201694b47fe88d3764e66d8894e.mp3 b/static/data/music/8101b201694b47fe88d3764e66d8894e.mp3 new file mode 100644 index 0000000..0d1f6eb Binary files /dev/null and b/static/data/music/8101b201694b47fe88d3764e66d8894e.mp3 differ diff --git a/static/data/music/9a534ade55264c16a392c48dc14aedcc.mp3 b/static/data/music/9a534ade55264c16a392c48dc14aedcc.mp3 new file mode 100644 index 0000000..ac53ab7 Binary files /dev/null and b/static/data/music/9a534ade55264c16a392c48dc14aedcc.mp3 differ diff --git a/static/data/music/a924275369454a819c3eed383754411e.mp3 b/static/data/music/a924275369454a819c3eed383754411e.mp3 new file mode 100644 index 0000000..67b20cc Binary files /dev/null and b/static/data/music/a924275369454a819c3eed383754411e.mp3 differ diff --git a/static/data/music/c9bf5b8afe124b949f09211359b8ff5b.mp3 b/static/data/music/c9bf5b8afe124b949f09211359b8ff5b.mp3 new file mode 100644 index 0000000..dd59a39 Binary files /dev/null and b/static/data/music/c9bf5b8afe124b949f09211359b8ff5b.mp3 differ diff --git a/static/data/music/d6a8f772629b43ecb5a9b03a6dea010c.mp3 b/static/data/music/d6a8f772629b43ecb5a9b03a6dea010c.mp3 new file mode 100644 index 0000000..6d7f2b7 Binary files /dev/null and b/static/data/music/d6a8f772629b43ecb5a9b03a6dea010c.mp3 differ diff --git a/static/data/music/d878521748e04486a1c6126467942f47.mp3 b/static/data/music/d878521748e04486a1c6126467942f47.mp3 new file mode 100644 index 0000000..0d1f6eb Binary files /dev/null and b/static/data/music/d878521748e04486a1c6126467942f47.mp3 differ diff --git a/static/data/music/fd6ed7f4a2c64a498ff64beaf19eacc2.mp3 b/static/data/music/fd6ed7f4a2c64a498ff64beaf19eacc2.mp3 new file mode 100644 index 0000000..89c8937 Binary files /dev/null and b/static/data/music/fd6ed7f4a2c64a498ff64beaf19eacc2.mp3 differ diff --git a/static/style/admin.css b/static/style/admin.css index 644d595..97cd720 100644 --- a/static/style/admin.css +++ b/static/style/admin.css @@ -75,4 +75,58 @@ td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; } .person summary { padding: .75rem 1rem; cursor: pointer; font-weight: 600; } .person .table-wrap { margin: 0; padding: 0 .5rem .5rem; } -.muted, .empty { color: var(--muted); font-weight: 400; } \ No newline at end of file +.muted, .empty { color: var(--muted); font-weight: 400; } + +.form label { + display: block; + margin-bottom: .25rem; + margin-top: 1rem; + font-size: .9rem; + color: var(--muted); +} + +.form input, +.form button { + width: 100%; + font-size: 1rem; /* mind. 16px, sonst zoomt iOS beim Fokussieren hinein */ + min-height: 2.75rem; /* gut mit dem Daumen treffbar */ +} + +.form button { + margin-top: 1rem; +} + +.file-upload { + display: flex; + align-items: center; + gap: 0.75rem; + position: relative; +} + +/* Das echte Input bleibt für Tastatur und Screenreader erreichbar, ist aber unsichtbar */ +.file-upload input[type="file"] { + position: absolute; + width: 1px; + height: 1px; + opacity: 0; + overflow: hidden; +} + +.file-button { + display: inline-block; + padding: 0.5rem 1rem; + border: 1px solid var(--border); + border-radius: 6px; + background: var(--surface); + cursor: pointer; + font: inherit; + transition: background 0.15s, border-color 0.15s; +} + +.file-name { + color: var(--text); + font-size: 0.9rem; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} \ No newline at end of file diff --git a/static/style/style.css b/static/style/style.css index 623ab8b..f3c82bd 100644 --- a/static/style/style.css +++ b/static/style/style.css @@ -149,4 +149,35 @@ audio { width: 100%; } color: var(--text); background: transparent; border: 1px dashed var(--muted); +} + +td.toggle { + width: 1.5em; + cursor: pointer; + text-align: center; + user-select: none; + height: 20px; +} + +td.toggle a { + display: inline-flex; + align-items: center; + justify-content: center; + width: 20px; + height: 20px; + background-color: var(--accent); + color: var(--accent-text); + text-decoration: none; + border-radius: 4px; + cursor: pointer; + user-select: none; +} + +td.toggle a:hover { + filter: brightness(1.1); /* optional: Hover-Effekt */ +} + +.percentage { + color: var(--muted); + font-size: small; } \ No newline at end of file diff --git a/templates/admin.html b/templates/admin.html index d338d72..cc29a8c 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -1,72 +1,21 @@ {% extends "base.html" %} -{% block title %}Auswertung – HörVergleich{% endblock %} {% block content %}
-

Auswertung

+

{% block admin_title %}Admin{% endblock %}

- CSV exportieren + {% block admin_header %}{% endblock %}
-
-
{{ stats.people }}Teilnehmer
-
{{ stats.guesses }}Bewertungen
-
- {{ stats.quote ~ ' %' if stats.quote is not none else '–' }} - Original gewählt -
-
+{% block admin_content %} -{% if not rows %} -

Noch keine Ergebnisse vorhanden.

-{% else %} -
- - - - - - - - - {% for r in rows %} - - - - - - - - {% endfor %} - -
NameGestartetBewertungenOriginal gewähltQuote
{{ r.name }}{{ r.started }}{{ r.total }}{{ r.right }}{{ r.quote }} %
-
+Unteraufgaben +Auswertung -

Einzelergebnisse

- {% for r in rows %} -
- {{ r.name }} ({{ r.right }}/{{ r.total }}, {{ r.started }}) -
- - - - {% for g in r.guesses %} - - - - - - - {% endfor %} - -
SongOriginal gewähltWahlBearbeitung
{{ songs.get(g.song_id, g.song_id) }}{{ 'ja' if g.right else 'nein' }}{{ g.choice }}{{ g.edit }}
-
-
- {% endfor %} -{% endif %} +{% endblock %} {% endblock %} \ No newline at end of file diff --git a/templates/admin_add.html b/templates/admin_add.html new file mode 100644 index 0000000..a5282e9 --- /dev/null +++ b/templates/admin_add.html @@ -0,0 +1,41 @@ +{% extends "admin.html" %} + +{% block admin_title %}Unteraufgabe hinzufügen{% endblock %} + +{% block admin_content %} +
+ + + + +
+ + + Keine Datei ausgewählt +
+ + +
+ + + +{% endblock %} \ No newline at end of file diff --git a/templates/admin_add_task.html b/templates/admin_add_task.html new file mode 100644 index 0000000..3e31a4c --- /dev/null +++ b/templates/admin_add_task.html @@ -0,0 +1,99 @@ +{% extends "admin.html" %} + +{% block admin_title %}Kopie erstellen{% endblock %} + +{% block admin_content %} +
+ + + +
+ + +
+ + + + + + + +
+ +
+ + + + + + + + + + + + + + + {% if song.edits %} + {% for e in song.edits %} + + + + + + + {% endfor %} + {% endif %} + +
IDBitrate (bit/s)Abtastrate (Hz)Dateigröße (MB)
Original{{ song.original.bitrate }}{{ song.original.sampling_rate }}{{ (song.original.size / 1000000) | round(2) }}
{{ e.id }}{{ e.bitrate }} ({{ (e.bitrate / song.original.bitrate * 100) | round(1) }}%) {{ e.get("mode", "cbr") | upper }}{{ e.sampling_rate }} ({{ (e.sampling_rate / song.original.sampling_rate * 100) | round(1) }}%){{ (e.size / 1000000) | round(2) }} ({{ (e.size / song.original.size * 100) | round(1) }}%)
+
+ + + +{% endblock %} \ No newline at end of file diff --git a/templates/admin_results.html b/templates/admin_results.html new file mode 100644 index 0000000..943be99 --- /dev/null +++ b/templates/admin_results.html @@ -0,0 +1,65 @@ +{% extends "admin.html" %} + +{% block admin_title %}Auswertung{% endblock %} + +{% block admin_content %} + +CSV exportieren + +
+
{{ stats.people }}Teilnehmer
+
{{ stats.guesses }}Bewertungen
+
+ {{ stats.quote ~ ' %' if stats.quote is not none else '–' }} + Original gewählt +
+
+ +{% if not rows %} +

Noch keine Ergebnisse vorhanden.

+{% else %} +
+ + + + + + + + + {% for r in rows %} + + + + + + + + {% endfor %} + +
NameGestartetBewertungenOriginal gewähltQuote
{{ r.name }}{{ r.started }}{{ r.total }}{{ r.right }}{{ r.quote }} %
+
+ +

Einzelergebnisse

+ {% for r in rows %} +
+ {{ r.name }} ({{ r.right }}/{{ r.total }}, {{ r.started }}) +
+ + + + {% for g in r.guesses %} + + + + + + + {% endfor %} + +
SongOriginal gewähltWahlBearbeitung
{{ songs.get(g.song_id, g.song_id) }}{{ 'ja' if g.right else 'nein' }}{{ g.choice }}{{ g.edit }}
+
+
+ {% endfor %} +{% endif %} +{% endblock %} \ No newline at end of file diff --git a/templates/admin_tasksList.html b/templates/admin_tasksList.html new file mode 100644 index 0000000..523af2e --- /dev/null +++ b/templates/admin_tasksList.html @@ -0,0 +1,52 @@ +{% extends "admin.html" %} + +{% block admin_title %}Unteraufgaben{% endblock %} + +{% block admin_header %} +Unteraufgabe hinzufügen +{% endblock %} + +{% block admin_content %} + +{% if not songs %} +

Noch keine Unteraufgabe vorhanden.

+{% else %} +
+ + + + + + + + + + + {% for s in songs %} + + + + + + + + + {% if s.edits %} + {% for e in s.edits %} + + + + + + + + + {% endfor %} + {% endif %} + {% endfor %} + +{% endif %} + +{% endblock %} \ No newline at end of file
NameIDBitrate (bit/s)Abtastrate (Hz)Dateigröße (MB)
+ + + {{ s.name }}{{ s.id }}{{ s.original.bitrate }}{{ s.original.sampling_rate }}{{ (s.original.size / 1000000) | round(2) }}
{{ e.bitrate }} ({{ (e.bitrate / s.original.bitrate * 100) | round(1) }}%){{ e.sampling_rate }} ({{ (e.sampling_rate / s.original.sampling_rate * 100) | round(1) }}%){{ (e.size / 1000000) | round(2) }} ({{ (e.size / s.original.size * 100) | round(1) }}%)