@Test public void getListOfMediaFiles_ShouldReturnListWithOneEntry_AndIgnoreMarkedFileInMarkSourceDir() throws Exception { Path dir1 = getPath("input","1"); Path file11 = createFile(dir1.resolve("file11.mp4")); createFile(dir1.resolve("file12.mp4")); createFile(scanSettings.base_input_dir().resolve("1").resolve("file12.mp4.done")); List<Media> result = subject.getListOfMediaFiles(dir1); assertThat(result).extracting(Media::getSourcePath).containsExactly(inputDir.relativize(file11)); }
List<Media> getListOfMediaFiles(Path path) { log.info("Scanning for media files in {}", path); return scannerProvider.get() .searchIn(path) .withRecursion(true) .withFileExtensions(scanConfig.allowed_extensions()) .whileSkippingExtraFilesWith(scanConfig.skip_extension_name()) .whileSkippingExtraFilesIn(scanConfig.mark_source_dir()) .streamAndIgnoreErrors() .map(file -> buildMedia(path, file)) .peek(candidate -> log.info("Found file: {}", candidate)) .collect(Collectors.toList()); }
MediaScanServiceImpl implements MediaScanService { List<Media> getListOfMediaFiles(Path path) { log.info("Scanning for media files in {}", path); return scannerProvider.get() .searchIn(path) .withRecursion(true) .withFileExtensions(scanConfig.allowed_extensions()) .whileSkippingExtraFilesWith(scanConfig.skip_extension_name()) .whileSkippingExtraFilesIn(scanConfig.mark_source_dir()) .streamAndIgnoreErrors() .map(file -> buildMedia(path, file)) .peek(candidate -> log.info("Found file: {}", candidate)) .collect(Collectors.toList()); } }
MediaScanServiceImpl implements MediaScanService { List<Media> getListOfMediaFiles(Path path) { log.info("Scanning for media files in {}", path); return scannerProvider.get() .searchIn(path) .withRecursion(true) .withFileExtensions(scanConfig.allowed_extensions()) .whileSkippingExtraFilesWith(scanConfig.skip_extension_name()) .whileSkippingExtraFilesIn(scanConfig.mark_source_dir()) .streamAndIgnoreErrors() .map(file -> buildMedia(path, file)) .peek(candidate -> log.info("Found file: {}", candidate)) .collect(Collectors.toList()); } @Inject  MediaScanServiceImpl(MediaScanConfig scanConfig,
                         Provider<FileScanner> scannerProvider); }
MediaScanServiceImpl implements MediaScanService { List<Media> getListOfMediaFiles(Path path) { log.info("Scanning for media files in {}", path); return scannerProvider.get() .searchIn(path) .withRecursion(true) .withFileExtensions(scanConfig.allowed_extensions()) .whileSkippingExtraFilesWith(scanConfig.skip_extension_name()) .whileSkippingExtraFilesIn(scanConfig.mark_source_dir()) .streamAndIgnoreErrors() .map(file -> buildMedia(path, file)) .peek(candidate -> log.info("Found file: {}", candidate)) .collect(Collectors.toList()); } @Inject  MediaScanServiceImpl(MediaScanConfig scanConfig,
                         Provider<FileScanner> scannerProvider); @Override Map<Path, List<Media>> retrieveFiles(); @Override List<Media> retrieveFilesAsList(); }
MediaScanServiceImpl implements MediaScanService { List<Media> getListOfMediaFiles(Path path) { log.info("Scanning for media files in {}", path); return scannerProvider.get() .searchIn(path) .withRecursion(true) .withFileExtensions(scanConfig.allowed_extensions()) .whileSkippingExtraFilesWith(scanConfig.skip_extension_name()) .whileSkippingExtraFilesIn(scanConfig.mark_source_dir()) .streamAndIgnoreErrors() .map(file -> buildMedia(path, file)) .peek(candidate -> log.info("Found file: {}", candidate)) .collect(Collectors.toList()); } @Inject  MediaScanServiceImpl(MediaScanConfig scanConfig,
                         Provider<FileScanner> scannerProvider); @Override Map<Path, List<Media>> retrieveFiles(); @Override List<Media> retrieveFilesAsList();  }