Add GetBestMatch to TvDbProvider (Provides a way to get the best result from a list of results)

Default value for Quality Dropbox in AddExisting is now the default value from Settings.
This commit is contained in:
Mark McDowall 2011-04-04 19:48:46 -07:00
parent 148fd044ef
commit 460e48d6a1
8 changed files with 33 additions and 697 deletions

View file

@ -80,12 +80,14 @@ namespace NzbDrone.Web.Controllers
ViewData["path"] = path;
ViewData["javaPath"] = path.Replace(Path.DirectorySeparatorChar, '|').Replace(Path.VolumeSeparatorChar, '^');
var defaultQuality = _configProvider.DefaultQualityProfile;
var qualityProfiles = _qualityProvider.GetAllProfiles();
ViewData["quality"] = new SelectList(
qualityProfiles,
"QualityProfileId",
"Name",
"HD");
defaultQuality); ;
return PartialView("AddSeriesItem", suggestions);
@ -117,8 +119,9 @@ namespace NzbDrone.Web.Controllers
public SelectList GetSuggestionList(string searchString)
{
var dataVal = _tvDbProvider.SearchSeries(searchString);
var bestResult = _tvDbProvider.GetBestMatch(dataVal.ToList(), searchString);
return new SelectList(dataVal, "Id", "SeriesName");
return new SelectList(dataVal, "Id", "SeriesName", bestResult);
}
}