1
0
Fork 0

files compare by size approach

This commit is contained in:
Xavier Fontanet 2024-05-19 16:06:17 +02:00
parent 752da4832c
commit d69712e905
1 changed files with 14 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class FailedImportFixer {
@ -29,9 +30,10 @@ public class FailedImportFixer {
var torrentPath = Path.of(queueRecord.getOutputPath());
List<Path> torrentFiles = getVideoFilesFrom(torrentPath);
var sonarPath = Path.of(serie.getPath());
List<Path> sonarFiles = getVideoFilesFrom(sonarPath);
printDifferencesBetween(torrentFiles, sonarFiles);
}
private List<Path> getVideoFilesFrom(Path torrentPath) throws IOException {
@ -42,4 +44,15 @@ public class FailedImportFixer {
.collect(Collectors.toList());
}
}
private void printDifferencesBetween(List<Path> torrentFiles, List<Path> sonarrFiles) {
Map<Long, List<Path>> torrentFileLengths = getFileLengthsMapFrom(torrentFiles);
Map<Long, List<Path>> sonarrFileLengths = getFileLengthsMapFrom(sonarrFiles);
//TODO checks & prints
}
private Map<Long, List<Path>> getFileLengthsMapFrom(List<Path> files) {
return files.stream()
.collect(Collectors.groupingBy(p -> p.toFile().length()));
}
}