|
|
@ -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. |
|
|
|
* @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 { |
|
|
|
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) { |
|
|
|
if (indexes != null && indexes.length == 1) { |
|
|
|
downloadFile(response, status, files.get(indexes[0]).getFile(), range); |
|
|
|
downloadFile(response, status, files.get(indexes[0]).getFile(), range); |
|
|
|
return; |
|
|
|
return; |
|
|
@ -232,8 +234,13 @@ public class DownloadController implements LastModified { |
|
|
|
|
|
|
|
|
|
|
|
for (MediaFile mediaFile : filesToDownload) { |
|
|
|
for (MediaFile mediaFile : filesToDownload) { |
|
|
|
zip(out, mediaFile.getParentFile(), mediaFile.getFile(), status, range); |
|
|
|
zip(out, mediaFile.getParentFile(), mediaFile.getFile(), status, range); |
|
|
|
} |
|
|
|
|
|
|
|
if (coverArtFile != null && coverArtFile.exists()) { |
|
|
|
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); |
|
|
|
zip(out, coverArtFile.getParentFile(), coverArtFile, status, range); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|