From c3425f493fa8d4c7e417dbbe6e7f4b00f9c3d6d7 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 10 Mar 2011 12:30:22 -0800 Subject: [PATCH] Modified TvDbProvider to aloow returning of multiple results when requesting a list of results. --- NzbDrone.Core/Providers/TvDbProvider.cs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/NzbDrone.Core/Providers/TvDbProvider.cs b/NzbDrone.Core/Providers/TvDbProvider.cs index 84ebfd98d..5651a5efc 100644 --- a/NzbDrone.Core/Providers/TvDbProvider.cs +++ b/NzbDrone.Core/Providers/TvDbProvider.cs @@ -27,17 +27,9 @@ public TvDbProvider() public IList SearchSeries(string title) { Logger.Debug("Searching TVDB for '{0}'", title); - var result = new List(); + var result = _handler.SearchSeries(title); - foreach (var tvdbSearchResult in _handler.SearchSeries(title)) - { - if (IsTitleMatch(tvdbSearchResult.SeriesName, title)) - { - result.Add(tvdbSearchResult); - } - } - - Logger.Debug("Search for '{0}' returned {1} results", title, result.Count); + Logger.Debug("Search for '{0}' returned {1} possible results", title, result.Count); return result; } @@ -48,7 +40,16 @@ public TvdbSearchResult GetSeries(string title) if (searchResults.Count == 0) 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)