Feat/auto generate edited files #2
No files matched your search
+2
-1
@@ -13,7 +13,8 @@
|
|||||||
{
|
{
|
||||||
"filename": "m004.mp3",
|
"filename": "m004.mp3",
|
||||||
"sampling_rate": 22.1,
|
"sampling_rate": 22.1,
|
||||||
"bitrate": 63
|
"bitrate": 63,
|
||||||
|
"id": "1"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,6 +322,12 @@ def admin_list():
|
|||||||
songs = load_songs_list()
|
songs = load_songs_list()
|
||||||
return render_template("admin_tasksList.html", songs=songs)
|
return render_template("admin_tasksList.html", songs=songs)
|
||||||
|
|
||||||
|
@bp.route("/admin/add/<task>")
|
||||||
|
@admin_required
|
||||||
|
def admin_add_task(task):
|
||||||
|
print(task)
|
||||||
|
return render_template("admin_add_task.html")
|
||||||
|
|
||||||
@bp.route("/api/admin/add", methods=["POST"])
|
@bp.route("/api/admin/add", methods=["POST"])
|
||||||
@admin_required
|
@admin_required
|
||||||
def api_admin_add():
|
def api_admin_add():
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
{% extends "admin.html" %}
|
||||||
|
|
||||||
|
{% block admin_title %}Kopie erstellen{% endblock %}
|
||||||
|
|
||||||
|
{% block admin_content %}
|
||||||
|
<form class="form" id="form">
|
||||||
|
<label for="titel">Titel</label>
|
||||||
|
<input id="title" name="title" type="text" autocomplete="off" required autofocus>
|
||||||
|
|
||||||
|
<label for="artist">Artist</label>
|
||||||
|
<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>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const form = document.getElementById("form");
|
||||||
|
form.addEventListener("submit", async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
const res = await fetch("/api/admin/add", {
|
||||||
|
method: "POST",
|
||||||
|
body: new FormData(form),
|
||||||
|
});
|
||||||
|
const result = await res.json();
|
||||||
|
console.log(result);
|
||||||
|
});
|
||||||
|
|
||||||
|
const fileInput = document.getElementById("file");
|
||||||
|
const fileName = document.getElementById("file-name");
|
||||||
|
fileInput.addEventListener("change", () => {
|
||||||
|
fileName.textContent = fileInput.files.length
|
||||||
|
? fileInput.files[0].name
|
||||||
|
: "Keine Datei ausgewählt";
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
{% for s in songs %}
|
{% for s in songs %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="toggle">
|
<td class="toggle">
|
||||||
<a>+</a>
|
<a href="{{ url_for('main.admin_add_task', task=s.id) }}">+</a>
|
||||||
</td>
|
</td>
|
||||||
<td>{{ s.name }}</td>
|
<td>{{ s.name }}</td>
|
||||||
<td>{{ s.artist }}</td>
|
<td>{{ s.artist }}</td>
|
||||||
|
|||||||
Reference in new issue
Block a user