feat: add table showing existing edits

This commit is contained in:
robin committed 2026-11-13 15:46:00 +01:00
1 parent 203bab6cf7
commit d026cc5470
2 files changed
+34 -9

No files matched your search

+7 -2
View File
@@ -325,8 +325,13 @@ def admin_list():
@bp.route("/admin/add/<songId>") @bp.route("/admin/add/<songId>")
@admin_required @admin_required
def admin_add_task(songId): def admin_add_task(songId):
print(songId) song = False
return render_template("admin_add_task.html") 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"]) @bp.route("/api/admin/add", methods=["POST"])
@admin_required @admin_required
+27 -7
View File
@@ -3,6 +3,7 @@
{% block admin_title %}Kopie erstellen{% endblock %} {% block admin_title %}Kopie erstellen{% endblock %}
{% block admin_content %} {% block admin_content %}
{{ song }}
<form class="form" id="form"> <form class="form" id="form">
<label for="titel">Titel</label> <label for="titel">Titel</label>
<input id="title" name="title" type="text" autocomplete="off" required autofocus> <input id="title" name="title" type="text" autocomplete="off" required autofocus>
@@ -10,16 +11,35 @@
<label for="artist">Artist</label> <label for="artist">Artist</label>
<input id="artist" name="artist" type="text" autocomplete="off"> <input id="artist" name="artist" type="text" autocomplete="off">
<label for="file">Datei</label>
<div class="file-upload">
<input id="file" name="file" type="file" accept="audio/*,.mp3,.wav,.flac,.ogg,.m4a" required>
<label for="file" class="file-button">Audiodatei wählen</label>
<span class="file-name" id="file-name">Keine Datei ausgewählt</span>
</div>
<button type="submit">Erstellen</button> <button type="submit">Erstellen</button>
</form> </form>
<div class="table-wrap" style="margin-top: 2rem;">
<table>
<thead>
<th>ID</th>
<th>Bitrate</th>
<th>Abtastrate</th>
</thead>
<tbody>
<tr>
<td>Original</td>
<td>{{ song.original.bitrate }}</td>
<td>{{ song.original.sampling_rate }}</td>
</tr>
{% if song.edits %}
{% for e in song.edits %}
<tr>
<td>{{ e.id }}</td>
<td>{{ e.bitrate }} ({{ (e.bitrate / song.original.bitrate * 100) | round(1) }}%)</td>
<td>{{ e.sampling_rate }} ({{ (e.sampling_rate / song.original.sampling_rate * 100) | round(1) }}%)</td>
</tr>
{% endfor %}
{% endif %}
</tbody>
</table>
</div>
<script> <script>
const form = document.getElementById("form"); const form = document.getElementById("form");
form.addEventListener("submit", async (event) => { form.addEventListener("submit", async (event) => {