Add button to download entire music library
This commit is contained in:
		@@ -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):
 | 
			
		||||
            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, requested_dir)
 | 
			
		||||
            zipfile = util.zipdir(requested_dir_fullpath, prefix)
 | 
			
		||||
            try:
 | 
			
		||||
                return send_file(zipfile, as_attachment=True)
 | 
			
		||||
            except Exception as e:
 | 
			
		||||
 
 | 
			
		||||
@@ -92,6 +92,11 @@
 | 
			
		||||
        {% endfor %}
 | 
			
		||||
    </ul>
 | 
			
		||||
    <h2>Music library:</h2>
 | 
			
		||||
    <form action="./download" method="get" class="directory">
 | 
			
		||||
        <input type="text" value="./" name="directory" hidden>
 | 
			
		||||
        <input type="submit" value="Download entire music library">
 | 
			
		||||
    </form>
 | 
			
		||||
    <br />
 | 
			
		||||
    {{ dirlisting() }}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user