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

This commit is contained in:
Mark McDowall 2011-03-10 12:30:22 -08:00
parent 48b89abfeb
commit c3425f493f
1 changed files with 12 additions and 11 deletions

View File

@ -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)