mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-09 19:52:16 +00:00
Implement recursive downloading of folders
Example use case: ``` Some Album/ ├── CD1 │ └── <songs> ├── CD2 │ └── <songs> └── cover.jpg ``` Previously, downloading the `Some Album` folder would result in no data being sent (not even `cover.jpg`) This commit changes folder-based downloads so that the entire folder tree (including any non-music) is added to the returned zip file. This allows any included album art, scans, notes, etc. to be distributed with the files. Album-based downloads are unaffected.
This commit is contained in:
parent
387a5e3de3
commit
359e391fcc
@ -249,8 +249,13 @@ def download_media():
|
||||
except ObjectNotFound:
|
||||
raise NotFound("Folder")
|
||||
|
||||
# Stream a zip of the tracks + cover art to the client
|
||||
# Stream a zip of multiple files to the client
|
||||
z = ZipStream(sized=True)
|
||||
if isinstance(rv, Folder):
|
||||
# Add the entire folder tree to the zip
|
||||
z.add_path(rv.path, recurse=True)
|
||||
else:
|
||||
# Add tracks + cover art to the zip
|
||||
for track in rv.tracks:
|
||||
z.add_path(track.path)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user