From c506a22999e8fcdf5a50bff5713697e6e9f9a683 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 7 Apr 2013 05:57:01 +0000 Subject: [PATCH] * rely less on error-prone webservices --- source/net/sourceforge/filebot/WebServices.java | 10 ++++++++++ .../sourceforge/filebot/similarity/EpisodeMetrics.java | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/net/sourceforge/filebot/WebServices.java b/source/net/sourceforge/filebot/WebServices.java index 629ef9be..2b399385 100644 --- a/source/net/sourceforge/filebot/WebServices.java +++ b/source/net/sourceforge/filebot/WebServices.java @@ -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") @Override public List fetchSearchResult(final String query, final Locale locale) throws Exception { diff --git a/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java b/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java index 08a24e90..b3168096 100644 --- a/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java +++ b/source/net/sourceforge/filebot/similarity/EpisodeMetrics.java @@ -469,7 +469,7 @@ public enum EpisodeMetrics implements SimilarityMetric { public float getRating(Object o) { if (o instanceof Episode) { 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) { return max(0, seriesInfo.getRating().floatValue()); }