Add button to download entire music library

This commit is contained in:
Fabian Würfl
2018-05-20 22:52:08 +02:00
parent b0137b2db6
commit 1e80ab2c0c
2 changed files with 10 additions and 2 deletions

View File

@ -169,8 +169,11 @@ def download():
folder_path = var.music_folder
requested_dir_fullpath = os.path.abspath(os.path.join(folder_path, requested_dir)) + '/'
if requested_dir_fullpath.startswith(folder_path):
prefix = secure_filename(os.path.relpath(requested_dir_fullpath, folder_path))
zipfile = util.zipdir(requested_dir_fullpath, requested_dir)
if os.path.samefile(requested_dir_fullpath, folder_path):
prefix = 'all'
else:
prefix = secure_filename(os.path.relpath(requested_dir_fullpath, folder_path))
zipfile = util.zipdir(requested_dir_fullpath, prefix)
try:
return send_file(zipfile, as_attachment=True)
except Exception as e: