* try fixing things up for the "thekilling" corner case

This commit is contained in:
Reinhard Pointner 2013-05-21 17:17:19 +00:00
parent ec83540afa
commit 0d569a88bc
3 changed files with 6 additions and 7 deletions

View File

@ -157,10 +157,9 @@ public final class WebServices {
public SeriesInfo getSeriesInfoByLocalIndex(String name, Locale locale) throws Exception { public SeriesInfo getSeriesInfoByLocalIndex(String name, Locale locale) throws Exception {
for (SearchResult it : getLocalIndex().search(name)) { List<SearchResult> results = getLocalIndex().search(name);
if (name.equals(it.getName())) { if (results.size() > 0) {
return getSeriesInfo((TheTVDBSearchResult) it, locale); return getSeriesInfo((TheTVDBSearchResult) results.get(0), locale);
}
} }
return null; return null;
} }

View File

@ -858,10 +858,10 @@ public class CmdlineOperations implements CmdlineInterface {
// use name similarity metric // use name similarity metric
final SimilarityMetric metric = new NameSimilarityMetric(); final SimilarityMetric metric = new NameSimilarityMetric();
// find probable matches using name similarity > 0.85 (or > 0.75 in non-strict mode) // find probable matches using name similarity > 0.8 (or > 0.6 in non-strict mode)
for (SearchResult result : searchResults) { for (SearchResult result : searchResults) {
float f = (query == null) ? 1 : metric.getSimilarity(query, result.getName()); float f = (query == null) ? 1 : metric.getSimilarity(query, result.getName());
if (f >= (strict && searchResults.size() > 1 ? 0.85 : 0.75) || ((f >= 0.5 || !strict) && result.getName().toLowerCase().startsWith(query.toLowerCase()))) { if (f >= (strict && searchResults.size() > 1 ? 0.8 : 0.6) || ((f >= 0.5 || !strict) && (result.getName().toLowerCase().startsWith(query.toLowerCase())))) {
if (!probableMatches.contains(result)) { if (!probableMatches.contains(result)) {
probableMatches.add(result); probableMatches.add(result);
} }

View File

@ -486,7 +486,7 @@ public enum EpisodeMetrics implements SimilarityMetric {
seriesInfoCache.put(n, seriesInfo); seriesInfoCache.put(n, seriesInfo);
} }
if (seriesInfo != null && seriesInfo.getRatingCount() >= 10) { if (seriesInfo != null && seriesInfo.getRatingCount() >= 20) {
return max(0, seriesInfo.getRating().floatValue()); return max(0, seriesInfo.getRating().floatValue());
} }
} }