diff --git a/backend/pom.xml b/backend/pom.xml index 9502c18..600daa3 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -76,11 +76,6 @@ commons-io ${commons-io.version} - - org.apache.commons - commons-compress - ${commons-compress.version} - diff --git a/backend/src/main/java/de/grimsi/gameyfin/service/FilesystemService.java b/backend/src/main/java/de/grimsi/gameyfin/service/FilesystemService.java index 3a9bf36..aa0d6e8 100644 --- a/backend/src/main/java/de/grimsi/gameyfin/service/FilesystemService.java +++ b/backend/src/main/java/de/grimsi/gameyfin/service/FilesystemService.java @@ -45,7 +45,9 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import java.util.stream.Stream; +import java.util.zip.Deflater; import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; @Slf4j @Service @@ -276,37 +278,24 @@ public class FilesystemService { } private void downloadFilesAsZip(Path path, OutputStream outputStream) { - final ParallelScatterZipCreator scatterZipCreator = new ParallelScatterZipCreator(); - - ZipArchiveOutputStream zipArchiveOutputStream; - - zipArchiveOutputStream = new ZipArchiveOutputStream(outputStream); - zipArchiveOutputStream.setUseZip64(Zip64Mode.AsNeeded); + ZipOutputStream zos = new ZipOutputStream(outputStream){{ + def.setLevel(Deflater.NO_COMPRESSION); + }}; try { Files.walkFileTree(path, new SimpleFileVisitor<>() { @SneakyThrows public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { - InputStreamSupplier streamSupplier = () -> { - InputStream is = null; - try { - is = Files.newInputStream(file); - } catch (IOException e) { - e.printStackTrace(); - } - return is; - }; - - ZipArchiveEntry zipArchiveEntry = new ZipArchiveEntry(path.relativize(file).toString()); - zipArchiveEntry.setMethod(ZipEntry.STORED); - scatterZipCreator.addArchiveEntry(zipArchiveEntry, streamSupplier); + zos.putNextEntry(new ZipEntry(path.relativize(file).toString())); + Files.copy(file, zos); + zos.closeEntry(); return FileVisitResult.CONTINUE; } }); - scatterZipCreator.writeTo(zipArchiveOutputStream); - zipArchiveOutputStream.close(); - } catch (IOException | InterruptedException | ExecutionException e) { + + zos.close(); + } catch (IOException e) { log.error("Error while zipping files:", e); } } diff --git a/backend/src/main/resources/application-dev.yml b/backend/src/main/resources/application-dev.yml index 5726cc2..2ca1b3b 100644 --- a/backend/src/main/resources/application-dev.yml +++ b/backend/src/main/resources/application-dev.yml @@ -1,7 +1,6 @@ gameyfin: #root: C:\Projects\privat\gameyfin-library - #root: \\NAS-Simon\Öffentlich\Spiele - root: C:\gameyfin-library + root: \\NAS-Simon\Öffentlich\Spiele cache: ${gameyfin.root}\.gameyfin\cache #db: ${gameyfin.root}\.gameyfin\db db: ./data diff --git a/backend/src/main/resources/application.yml b/backend/src/main/resources/application.yml index 688f309..66f9135 100644 --- a/backend/src/main/resources/application.yml +++ b/backend/src/main/resources/application.yml @@ -3,6 +3,8 @@ server: error.include-stacktrace: never spring: + mvc: + async.request-timeout: -1 jackson.default-property-inclusion: non_null datasource.db-name: gameyfin_db datasource.url: jdbc:h2:file:${gameyfin.db}/${spring.datasource.db-name};AUTO_SERVER=TRUE