* fix matching issues, esp for movies and shows with many aliases
This commit is contained in:
parent
284d53bee5
commit
dc58ae1954
|
@ -550,6 +550,13 @@ public class MediaDetection {
|
|||
terms = new LinkedHashSet<String>(reduceMovieNamePermutations(terms));
|
||||
|
||||
List<Movie> movieNameMatches = matchMovieName(terms, true, 0);
|
||||
|
||||
// skip further queries if collected matches are already sufficient
|
||||
if (movieNameMatches.size() > 0) {
|
||||
options.addAll(movieNameMatches);
|
||||
return sortBySimilarity(options, terms, getMovieMatchMetric(), true);
|
||||
}
|
||||
|
||||
if (movieNameMatches.isEmpty()) {
|
||||
movieNameMatches = matchMovieName(terms, strict, 2);
|
||||
}
|
||||
|
@ -752,7 +759,7 @@ public class MediaDetection {
|
|||
if (movieIndex.isEmpty()) {
|
||||
try {
|
||||
for (Movie movie : releaseInfo.getMovieList()) {
|
||||
for (String name : movie.getEffectiveNames()) {
|
||||
for (String name : movie.getEffectiveNamesWithoutYear()) {
|
||||
movieIndex.add(new SimpleEntry<String, Movie>(normalizePunctuation(name).toLowerCase(), movie));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -202,7 +202,7 @@ public enum EpisodeMetrics implements SimilarityMetric {
|
|||
protected Object[] fields(Object object) {
|
||||
if (object instanceof Episode) {
|
||||
Episode episode = (Episode) object;
|
||||
LinkedHashSet<String> set = new LinkedHashSet<String>(4);
|
||||
LinkedHashSet<String> set = new LinkedHashSet<String>(5);
|
||||
set.add(removeTrailingBrackets(episode.getSeriesName()));
|
||||
set.add(removeTrailingBrackets(episode.getTitle()));
|
||||
for (String it : episode.getSeries().getEffectiveNames()) {
|
||||
|
@ -210,7 +210,7 @@ public enum EpisodeMetrics implements SimilarityMetric {
|
|||
}
|
||||
|
||||
Iterator<String> itr = set.iterator();
|
||||
Object[] f = new Object[4];
|
||||
Object[] f = new Object[5];
|
||||
for (int i = 0; i < f.length; i++) {
|
||||
f[i] = itr.hasNext() ? itr.next() : null;
|
||||
}
|
||||
|
|
|
@ -5,15 +5,9 @@ import static java.lang.Math.*;
|
|||
public class MetricCascade implements SimilarityMetric {
|
||||
|
||||
private final SimilarityMetric[] cascade;
|
||||
private final boolean shortCircuit;
|
||||
|
||||
public MetricCascade(SimilarityMetric... cascade) {
|
||||
this(true, cascade);
|
||||
}
|
||||
|
||||
public MetricCascade(boolean shortCircuit, SimilarityMetric... cascade) {
|
||||
this.cascade = cascade;
|
||||
this.shortCircuit = shortCircuit;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,19 +17,14 @@ public class MetricCascade implements SimilarityMetric {
|
|||
float similarity = metric.getSimilarity(o1, o2);
|
||||
if (abs(similarity) >= abs(f)) {
|
||||
// perfect match, ignore remaining metrics
|
||||
if (shortCircuit) {
|
||||
if (similarity >= 1) {
|
||||
return similarity;
|
||||
} else if (similarity <= -1) {
|
||||
return similarity;
|
||||
}
|
||||
if (similarity >= 1) {
|
||||
return similarity;
|
||||
}
|
||||
|
||||
// possible match or perfect negative match
|
||||
f = similarity;
|
||||
}
|
||||
}
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
|
|
@ -57,6 +57,10 @@ public class Movie extends SearchResult {
|
|||
return names;
|
||||
}
|
||||
|
||||
public List<String> getEffectiveNamesWithoutYear() {
|
||||
return super.getEffectiveNames();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof Movie) {
|
||||
|
|
|
@ -553,7 +553,7 @@ DB
|
|||
DC
|
||||
DC-AG
|
||||
DCA
|
||||
dcn
|
||||
DcN
|
||||
DCP
|
||||
DCT
|
||||
DCTP
|
||||
|
|
Loading…
Reference in New Issue