feat: show percentages

feat: show file size in MB
This commit is contained in:
robin committed 2026-11-13 17:09:21 +01:00
1 parent 7ddb932a6c
commit a9ccdca62c
5 files changed
+22 -16

No files matched your search

+7 -6
View File
@@ -338,7 +338,6 @@ def admin_add_task(songId):
@admin_required
def api_admin_add():
title = request.form.get("title", "").strip()
artist = request.form.get("artist", "").strip()
file = request.files.get("file")
if not title:
@@ -352,20 +351,21 @@ def api_admin_add():
filename_new = uuid.uuid4().hex + ext
BASE_MUSIC_DIR.mkdir(parents=True, exist_ok=True)
file.save(BASE_MUSIC_DIR / filename_new)
path = BASE_MUSIC_DIR / filename_new
file.save(path)
# read bitrate and sampling rate
audio = File(BASE_MUSIC_DIR / filename_new)
audio = File(path)
#stem = os.path.splitext(filename_new)[0]
song = add_song({
"name": title,
"artist": artist,
"original": {
"filename": filename_new,
"sampling_rate": audio.info.sample_rate,
"bitrate": audio.info.bitrate
},
"bitrate": audio.info.bitrate,
"size": path.stat().st_size, # Bytes
},
"edits": [],
})
@@ -440,6 +440,7 @@ def api_admin_add_task(songId):
"quality": quality if mode == "vbr" else None,
"bitrate": actual_bitrate,
"sampling_rate": actual_rate,
"size": dst.stat().st_size, # Bytes
})
save_songs_list(songs)