diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java index 105a0596..87151379 100644 --- a/source/net/filebot/media/MediaDetection.java +++ b/source/net/filebot/media/MediaDetection.java @@ -3,6 +3,7 @@ package net.filebot.media; import static java.util.Collections.*; import static java.util.regex.Pattern.*; import static java.util.stream.Collectors.*; +import static net.filebot.Logging.*; import static net.filebot.MediaTypes.*; import static net.filebot.Settings.*; import static net.filebot.similarity.CommonSequenceMatcher.*; @@ -729,11 +730,14 @@ public class MediaDetection { // similarity comparator with multi-value support SimilarityComparator comparator = new SimilarityComparator(metric, terms, mapper); + // sort by ranking and remove duplicate entries + List ranking = options.stream().sorted(comparator).distinct().collect(toList()); + // DEBUG - // System.out.format("sortBySimilarity %s => %s%n", terms, options.stream().sorted(comparator).distinct().collect(toList())); + debug.finest(format("%s => %s", terms, ranking)); // sort by ranking and remove duplicate entries - return options.stream().sorted(comparator).distinct().collect(toList()); + return ranking; } public static List sortMoviesBySimilarity(Collection options, Collection terms) throws IOException { @@ -940,7 +944,7 @@ public class MediaDetection { querySet = getUniqueQuerySet(emptySet(), stripBlacklistedTerms(querySet)); // DEBUG - // System.out.format("Query %s: %s%n", queryLookupService.getName(), querySet); + debug.finest(format("%s => %s", queryLookupService.getName(), querySet)); final Map probabilityMap = new LinkedHashMap(); final SimilarityMetric metric = getMovieMatchMetric(); diff --git a/source/net/filebot/similarity/Matcher.java b/source/net/filebot/similarity/Matcher.java index 4f25431d..d49b81aa 100644 --- a/source/net/filebot/similarity/Matcher.java +++ b/source/net/filebot/similarity/Matcher.java @@ -140,7 +140,7 @@ public class Matcher { float similarity = metric.getSimilarity(possibleMatch.getValue(), possibleMatch.getCandidate()); // DEBUG - debug.finest(format("%s: %.04f: %s", metric, similarity, possibleMatch)); + debug.finest(format("%s %.04f => %s", metric, similarity, possibleMatch)); Set> matchSet = similarityMap.get(similarity); if (matchSet == null) {