Modified TvDbProvider to aloow returning of multiple results when requesting a list of results.

pull/4/head
Mark McDowall 14 years ago
parent 48b89abfeb
commit c3425f493f

@ -27,17 +27,9 @@ namespace NzbDrone.Core.Providers
public IList<TvdbSearchResult> SearchSeries(string title) public IList<TvdbSearchResult> SearchSeries(string title)
{ {
Logger.Debug("Searching TVDB for '{0}'", title); Logger.Debug("Searching TVDB for '{0}'", title);
var result = new List<TvdbSearchResult>(); var result = _handler.SearchSeries(title);
foreach (var tvdbSearchResult in _handler.SearchSeries(title)) Logger.Debug("Search for '{0}' returned {1} possible results", title, result.Count);
{
if (IsTitleMatch(tvdbSearchResult.SeriesName, title))
{
result.Add(tvdbSearchResult);
}
}
Logger.Debug("Search for '{0}' returned {1} results", title, result.Count);
return result; return result;
} }
@ -48,7 +40,16 @@ namespace NzbDrone.Core.Providers
if (searchResults.Count == 0) if (searchResults.Count == 0)
return null; return null;
return searchResults[0]; foreach (var tvdbSearchResult in searchResults)
{
if (IsTitleMatch(tvdbSearchResult.SeriesName, title))
{
Logger.Debug("Search for '{0}' was successful", title);
return tvdbSearchResult;
}
}
return null;
} }
public TvdbSeries GetSeries(int id, bool loadEpisodes) public TvdbSeries GetSeries(int id, bool loadEpisodes)

Loading…
Cancel
Save