1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-26 09:47:39 +00:00

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

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)