* better code-reuse

This commit is contained in:
Reinhard Pointner 2014-09-15 19:44:56 +00:00
parent 56253dfb7a
commit e3117e0395
2 changed files with 2 additions and 10 deletions

View File

@ -1148,7 +1148,7 @@ public class MediaDetection {
List<File> nfoFiles = new ArrayList<File>();
if (file.isDirectory()) {
nfoFiles.addAll(filter(listFiles(file), NFO_FILES));
} else if (file.getParentFile().isDirectory()) {
} else if (file.getParentFile() != null && file.getParentFile().isDirectory()) {
nfoFiles.addAll(getChildren(file.getParentFile(), NFO_FILES));
}

View File

@ -18,7 +18,6 @@ import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
@ -474,14 +473,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
List<Match<File, ?>> matches = new ArrayList<Match<File, ?>>();
if (input != null && input.length() > 0) {
Collection<Movie> results = new LinkedHashSet<Movie>();
// data from local index has precedence same as in standard movie detection
results.addAll(matchMovieName(singleton(input), false, 0));
results.addAll(service.searchMovie(input, locale));
// improve ranking
results = sortBySimilarity(results, singleton(input), getMovieMatchMetric(), false);
List<Movie> results = detectMovie(new File(input), null, service, locale, false);
for (Movie it : results) {
matches.add(new Match<File, Movie>(null, it));