* better code-reuse
This commit is contained in:
parent
56253dfb7a
commit
e3117e0395
@ -1148,7 +1148,7 @@ public class MediaDetection {
|
|||||||
List<File> nfoFiles = new ArrayList<File>();
|
List<File> nfoFiles = new ArrayList<File>();
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
nfoFiles.addAll(filter(listFiles(file), NFO_FILES));
|
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));
|
nfoFiles.addAll(getChildren(file.getParentFile(), NFO_FILES));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ import java.util.Collection;
|
|||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -474,14 +473,7 @@ class MovieHashMatcher implements AutoCompleteMatcher {
|
|||||||
|
|
||||||
List<Match<File, ?>> matches = new ArrayList<Match<File, ?>>();
|
List<Match<File, ?>> matches = new ArrayList<Match<File, ?>>();
|
||||||
if (input != null && input.length() > 0) {
|
if (input != null && input.length() > 0) {
|
||||||
Collection<Movie> results = new LinkedHashSet<Movie>();
|
List<Movie> results = detectMovie(new File(input), null, service, locale, false);
|
||||||
|
|
||||||
// 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);
|
|
||||||
|
|
||||||
for (Movie it : results) {
|
for (Movie it : results) {
|
||||||
matches.add(new Match<File, Movie>(null, it));
|
matches.add(new Match<File, Movie>(null, it));
|
||||||
|
Loading…
Reference in New Issue
Block a user