files compare by size approach
This commit is contained in:
parent
752da4832c
commit
d69712e905
|
@ -7,6 +7,7 @@ import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class FailedImportFixer {
|
public class FailedImportFixer {
|
||||||
|
@ -29,9 +30,10 @@ public class FailedImportFixer {
|
||||||
|
|
||||||
var torrentPath = Path.of(queueRecord.getOutputPath());
|
var torrentPath = Path.of(queueRecord.getOutputPath());
|
||||||
List<Path> torrentFiles = getVideoFilesFrom(torrentPath);
|
List<Path> torrentFiles = getVideoFilesFrom(torrentPath);
|
||||||
|
|
||||||
var sonarPath = Path.of(serie.getPath());
|
var sonarPath = Path.of(serie.getPath());
|
||||||
List<Path> sonarFiles = getVideoFilesFrom(sonarPath);
|
List<Path> sonarFiles = getVideoFilesFrom(sonarPath);
|
||||||
|
|
||||||
|
printDifferencesBetween(torrentFiles, sonarFiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Path> getVideoFilesFrom(Path torrentPath) throws IOException {
|
private List<Path> getVideoFilesFrom(Path torrentPath) throws IOException {
|
||||||
|
@ -42,4 +44,15 @@ public class FailedImportFixer {
|
||||||
.collect(Collectors.toList());
|
.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()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue