* rely less on error-prone webservices
This commit is contained in:
parent
e7d67b3ed7
commit
c506a22999
|
@ -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 {
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue