refactor: support for multiple formats

This commit is contained in:
robin committed 2026-11-13 12:17:38 +01:00
1 parent 29ebab923d
commit 3f62e4e2d2
2 files changed
+6 -6

No files matched your search

+2 -2
View File
@@ -5,13 +5,13 @@
"id": "002",
"original_name": "-",
"original": {
"filename": "m003",
"filename": "m003.mp3",
"sampling_rate": 44.1,
"bitrate": 256
},
"edits": [
{
"filename": "m004",
"filename": "m004.mp3",
"sampling_rate": 22.1,
"bitrate": 63
}
+4 -4
View File
@@ -135,8 +135,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
@@ -330,11 +330,11 @@ def api_admin_add():
BASE_MUSIC_DIR.mkdir(parents=True, exist_ok=True)
file.save(BASE_MUSIC_DIR / filename_new)
stem = os.path.splitext(filename_new)[0]
#stem = os.path.splitext(filename_new)[0]
song = add_song({
"name": title,
"artist": artist,
"original": {"filename": stem},
"original": {"filename": filename_new},
"edits": [],
})