diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java index ed8debae..89278c9a 100644 --- a/source/net/filebot/media/MediaDetection.java +++ b/source/net/filebot/media/MediaDetection.java @@ -611,8 +611,8 @@ public class MediaDetection { } } - // search by file name or folder name - Collection terms = new LinkedHashSet(); + // search by file name or folder name (initialize with known options) + Set terms = options.stream().map(Movie::getNameWithYear).collect(toCollection(LinkedHashSet::new)); // 1. term: try to match movie pattern 'name (year)' or use filename as is terms.add(getName(movieFile)); @@ -745,11 +745,11 @@ public class MediaDetection { } public static List sortMoviesBySimilarity(Collection options, Collection terms) throws Exception { - Collection paragon = new TreeSet(String.CASE_INSENSITIVE_ORDER); + Set paragon = new TreeSet(String.CASE_INSENSITIVE_ORDER); paragon.addAll(stripReleaseInfo(terms, true)); paragon.addAll(stripReleaseInfo(terms, false)); - return sortBySimilarity(options, paragon, getMovieMatchMetric(), SearchResult::getEffectiveNames); + return sortBySimilarity(options, paragon, getMovieMatchMetric()); } public static boolean isEpisodeNumberMatch(File f, Episode e) { @@ -778,7 +778,7 @@ public class MediaDetection { return null; } - public static Collection reduceMovieNamePermutations(Collection terms) throws IOException { + public static List reduceMovieNamePermutations(Collection terms) throws IOException { LinkedList names = new LinkedList(); for (String it : terms) {