Make sure that movie selection is unique

This commit is contained in:
Reinhard Pointner 2016-05-11 13:14:30 +08:00
parent 46a428abf3
commit 4d18963f1f
2 changed files with 2 additions and 8 deletions

View File

@ -1252,7 +1252,7 @@ public class MediaDetection {
public static List<SearchResult> getProbableMatches(String query, Collection<? extends SearchResult> options, boolean alias, boolean strict) {
if (query == null) {
return new ArrayList<SearchResult>(options);
return options.stream().distinct().collect(toList());
}
// check all alias names, or just the primary name

View File

@ -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<String> intersection = new HashSet<String>(getEffectiveNames());
intersection.retainAll(other.getEffectiveNames());
return intersection.size() > 0;
return year == other.year && new HashSet<String>(getEffectiveNamesWithoutYear()).removeAll(other.getEffectiveNamesWithoutYear());
}
return false;