Make sure that movie selection is unique
This commit is contained in:
parent
46a428abf3
commit
4d18963f1f
|
@ -1252,7 +1252,7 @@ public class MediaDetection {
|
||||||
|
|
||||||
public static List<SearchResult> getProbableMatches(String query, Collection<? extends SearchResult> options, boolean alias, boolean strict) {
|
public static List<SearchResult> getProbableMatches(String query, Collection<? extends SearchResult> options, boolean alias, boolean strict) {
|
||||||
if (query == null) {
|
if (query == null) {
|
||||||
return new ArrayList<SearchResult>(options);
|
return options.stream().distinct().collect(toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
// check all alias names, or just the primary name
|
// check all alias names, or just the primary name
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
public class Movie extends SearchResult {
|
public class Movie extends SearchResult {
|
||||||
|
|
||||||
|
@ -85,13 +84,8 @@ public class Movie extends SearchResult {
|
||||||
if (imdbId > 0 && other.imdbId > 0) {
|
if (imdbId > 0 && other.imdbId > 0) {
|
||||||
return imdbId == other.imdbId;
|
return imdbId == other.imdbId;
|
||||||
}
|
}
|
||||||
if (year != other.year) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Set<String> intersection = new HashSet<String>(getEffectiveNames());
|
return year == other.year && new HashSet<String>(getEffectiveNamesWithoutYear()).removeAll(other.getEffectiveNamesWithoutYear());
|
||||||
intersection.retainAll(other.getEffectiveNames());
|
|
||||||
return intersection.size() > 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue