Add button to download entire music library
This commit is contained in:
		@@ -169,8 +169,11 @@ def download():
 | 
				
			|||||||
        folder_path = var.music_folder
 | 
					        folder_path = var.music_folder
 | 
				
			||||||
        requested_dir_fullpath = os.path.abspath(os.path.join(folder_path, requested_dir)) + '/'
 | 
					        requested_dir_fullpath = os.path.abspath(os.path.join(folder_path, requested_dir)) + '/'
 | 
				
			||||||
        if requested_dir_fullpath.startswith(folder_path):
 | 
					        if requested_dir_fullpath.startswith(folder_path):
 | 
				
			||||||
            prefix = secure_filename(os.path.relpath(requested_dir_fullpath, folder_path))
 | 
					            if os.path.samefile(requested_dir_fullpath, folder_path):
 | 
				
			||||||
            zipfile = util.zipdir(requested_dir_fullpath, requested_dir)
 | 
					                prefix = 'all'
 | 
				
			||||||
 | 
					            else:
 | 
				
			||||||
 | 
					                prefix = secure_filename(os.path.relpath(requested_dir_fullpath, folder_path))
 | 
				
			||||||
 | 
					            zipfile = util.zipdir(requested_dir_fullpath, prefix)
 | 
				
			||||||
            try:
 | 
					            try:
 | 
				
			||||||
                return send_file(zipfile, as_attachment=True)
 | 
					                return send_file(zipfile, as_attachment=True)
 | 
				
			||||||
            except Exception as e:
 | 
					            except Exception as e:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -92,6 +92,11 @@
 | 
				
			|||||||
        {% endfor %}
 | 
					        {% endfor %}
 | 
				
			||||||
    </ul>
 | 
					    </ul>
 | 
				
			||||||
    <h2>Music library:</h2>
 | 
					    <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() }}
 | 
					    {{ dirlisting() }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user