* more lenient derived-file detection
This commit is contained in:
parent
3f9523ff2f
commit
49271e2eee
|
@ -266,20 +266,21 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||
// handle movie files
|
||||
List<File> movieFiles = filter(files, VIDEO_FILES);
|
||||
|
||||
List<File> standaloneFiles = new ArrayList<File>(files);
|
||||
standaloneFiles.removeAll(movieFiles);
|
||||
|
||||
Map<File, List<File>> derivatesByMovieFile = new HashMap<File, List<File>>();
|
||||
for (File movieFile : movieFiles) {
|
||||
derivatesByMovieFile.put(movieFile, new ArrayList<File>());
|
||||
}
|
||||
for (File file : files) {
|
||||
for (File file : standaloneFiles) {
|
||||
for (File movieFile : movieFiles) {
|
||||
if (!file.equals(movieFile) && isDerived(file, movieFile)) {
|
||||
if (isDerived(file, movieFile)) {
|
||||
derivatesByMovieFile.get(movieFile).add(file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<File> standaloneFiles = new ArrayList<File>(files);
|
||||
for (List<File> derivates : derivatesByMovieFile.values()) {
|
||||
standaloneFiles.removeAll(derivates);
|
||||
}
|
||||
|
|
|
@ -60,20 +60,21 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
|||
// handle movie files
|
||||
List<File> movieFiles = filter(files, VIDEO_FILES);
|
||||
|
||||
List<File> standaloneFiles = new ArrayList<File>(files);
|
||||
standaloneFiles.removeAll(movieFiles);
|
||||
|
||||
Map<File, List<File>> derivatesByMovieFile = new HashMap<File, List<File>>();
|
||||
for (File movieFile : movieFiles) {
|
||||
derivatesByMovieFile.put(movieFile, new ArrayList<File>());
|
||||
}
|
||||
for (File file : files) {
|
||||
for (File file : standaloneFiles) {
|
||||
for (File movieFile : movieFiles) {
|
||||
if (!file.equals(movieFile) && isDerived(file, movieFile)) {
|
||||
if (isDerived(file, movieFile)) {
|
||||
derivatesByMovieFile.get(movieFile).add(file);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<File> standaloneFiles = new ArrayList<File>(files);
|
||||
for (List<File> derivates : derivatesByMovieFile.values()) {
|
||||
standaloneFiles.removeAll(derivates);
|
||||
}
|
||||
|
|
|
@ -253,7 +253,9 @@ public final class FileUtilities {
|
|||
|
||||
|
||||
public static boolean isDerived(String derivate, File prime) {
|
||||
String base = getName(prime).trim().toLowerCase();
|
||||
String withoutTypeSuffix = getNameWithoutExtension(prime.getName());
|
||||
String withoutPartSuffix = getNameWithoutExtension(withoutTypeSuffix);
|
||||
String base = (withoutPartSuffix.length() > 2 ? withoutPartSuffix : withoutTypeSuffix).trim().toLowerCase();
|
||||
derivate = derivate.trim().toLowerCase();
|
||||
return derivate.startsWith(base);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue