* rely less on error-prone webservices

This commit is contained in:
Reinhard Pointner 2013-04-07 05:57:01 +00:00
parent e7d67b3ed7
commit c506a22999
2 changed files with 11 additions and 1 deletions

View File

@ -156,6 +156,16 @@ public final class WebServices {
} }
public SeriesInfo getSeriesInfoByLocalIndex(String name, Locale locale) throws Exception {
for (SearchResult it : getLocalIndex().search(name)) {
if (name.equals(it.getName())) {
return getSeriesInfo((TheTVDBSearchResult) it, locale);
}
}
return null;
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<SearchResult> fetchSearchResult(final String query, final Locale locale) throws Exception { public List<SearchResult> fetchSearchResult(final String query, final Locale locale) throws Exception {

View File

@ -469,7 +469,7 @@ public enum EpisodeMetrics implements SimilarityMetric {
public float getRating(Object o) { public float getRating(Object o) {
if (o instanceof Episode) { if (o instanceof Episode) {
try { try {
SeriesInfo seriesInfo = WebServices.TheTVDB.getSeriesInfoByName(((Episode) o).getSeriesName(), Locale.ENGLISH); SeriesInfo seriesInfo = WebServices.TheTVDB.getSeriesInfoByLocalIndex(((Episode) o).getSeriesName(), Locale.ENGLISH);
if (seriesInfo != null && seriesInfo.getRatingCount() >= 10) { if (seriesInfo != null && seriesInfo.getRatingCount() >= 10) {
return max(0, seriesInfo.getRating().floatValue()); return max(0, seriesInfo.getRating().floatValue());
} }