|
|
|
@ -207,6 +207,8 @@ public class DownloadController implements LastModified { |
|
|
|
|
* @param zipFileName The name of the resulting zip file. @throws IOException If an I/O error occurs. |
|
|
|
|
*/ |
|
|
|
|
private void downloadFiles(HttpServletResponse response, TransferStatus status, List<MediaFile> files, int[] indexes, File coverArtFile, HttpRange range, String zipFileName) throws IOException { |
|
|
|
|
boolean cover_embedded = false; |
|
|
|
|
|
|
|
|
|
if (indexes != null && indexes.length == 1) { |
|
|
|
|
downloadFile(response, status, files.get(indexes[0]).getFile(), range); |
|
|
|
|
return; |
|
|
|
@ -232,8 +234,13 @@ public class DownloadController implements LastModified { |
|
|
|
|
|
|
|
|
|
for (MediaFile mediaFile : filesToDownload) { |
|
|
|
|
zip(out, mediaFile.getParentFile(), mediaFile.getFile(), status, range); |
|
|
|
|
} |
|
|
|
|
if (coverArtFile != null && coverArtFile.exists()) { |
|
|
|
|
if (mediaFile.getFile().getCanonicalPath() == coverArtFile.getCanonicalPath()) { |
|
|
|
|
cover_embedded = true; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (coverArtFile != null && coverArtFile.exists() && cover_embedded == false) { |
|
|
|
|
zip(out, coverArtFile.getParentFile(), coverArtFile, status, range); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|