1
0
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:
Carey Metcalfe 2021-10-07 10:22:37 -04:00
parent 387a5e3de3
commit 359e391fcc

View File

@ -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)