From 4d18963f1f82f83f3bcbf21e83622d92bfc12c77 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 11 May 2016 13:14:30 +0800 Subject: [PATCH] Make sure that movie selection is unique --- source/net/filebot/media/MediaDetection.java | 2 +- source/net/filebot/web/Movie.java | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/source/net/filebot/media/MediaDetection.java b/source/net/filebot/media/MediaDetection.java index ea2107d2..d49a96ff 100644 --- a/source/net/filebot/media/MediaDetection.java +++ b/source/net/filebot/media/MediaDetection.java @@ -1252,7 +1252,7 @@ public class MediaDetection { public static List getProbableMatches(String query, Collection options, boolean alias, boolean strict) { if (query == null) { - return new ArrayList(options); + return options.stream().distinct().collect(toList()); } // check all alias names, or just the primary name diff --git a/source/net/filebot/web/Movie.java b/source/net/filebot/web/Movie.java index e36e2739..ceaadb9e 100644 --- a/source/net/filebot/web/Movie.java +++ b/source/net/filebot/web/Movie.java @@ -5,7 +5,6 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Locale; -import java.util.Set; public class Movie extends SearchResult { @@ -85,13 +84,8 @@ public class Movie extends SearchResult { if (imdbId > 0 && other.imdbId > 0) { return imdbId == other.imdbId; } - if (year != other.year) { - return false; - } - Set intersection = new HashSet(getEffectiveNames()); - intersection.retainAll(other.getEffectiveNames()); - return intersection.size() > 0; + return year == other.year && new HashSet(getEffectiveNamesWithoutYear()).removeAll(other.getEffectiveNamesWithoutYear()); } return false;