diff --git a/IISExpress/AppServer/applicationhost.config b/IISExpress/AppServer/applicationhost.config index ffcf44ec6..6c56a7b72 100644 --- a/IISExpress/AppServer/applicationhost.config +++ b/IISExpress/AppServer/applicationhost.config @@ -148,7 +148,7 @@ - + diff --git a/NzbDrone.5.1.ReSharper b/NzbDrone.5.1.ReSharper deleted file mode 100644 index f86d34090..000000000 --- a/NzbDrone.5.1.ReSharper +++ /dev/null @@ -1,153 +0,0 @@ - - - - - SOLUTION - - - - public - protected - internal - private - new - abstract - virtual - override - sealed - static - readonly - extern - unsafe - volatile - - - - - $object$_On$event$ - $event$Handler - - - - - - - - - - - - - - - - - - - - - 2 - False - False - False - False - False - CHOP_IF_LONG - CHOP_IF_LONG - 200 - CHOP_IF_LONG - - - False - - - $object$_On$event$ - $event$Handler - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - $object$_On$event$ - $event$Handler - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/NzbDrone.Core.Test/ParserTest.cs b/NzbDrone.Core.Test/ParserTest.cs index 9532db969..4b718ac9e 100644 --- a/NzbDrone.Core.Test/ParserTest.cs +++ b/NzbDrone.Core.Test/ParserTest.cs @@ -13,7 +13,7 @@ namespace NzbDrone.Core.Test public class ParserTest { [Test] - [Row("Sonny.With.a.Chance.S02E15", 2,15)] + [Row("Sonny.With.a.Chance.S02E15", 2, 15)] [Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", 3, 1)] [Row("Two.and.a.Half.Me.103.720p.HDTV.X264-DIMENSION", 1, 3)] [Row("Two.and.a.Half.Me.113.720p.HDTV.X264-DIMENSION", 1, 13)] @@ -73,4 +73,4 @@ namespace NzbDrone.Core.Test Assert.AreEqual(clean, result); } } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Parser.cs b/NzbDrone.Core/Parser.cs index df6491f50..757eb546f 100644 --- a/NzbDrone.Core/Parser.cs +++ b/NzbDrone.Core/Parser.cs @@ -256,6 +256,6 @@ namespace NzbDrone.Core return info.FullName.Trim('/', '\\', ' '); } - + } -} +} \ No newline at end of file diff --git a/NzbDrone.Core/Providers/ITvDbProvider.cs b/NzbDrone.Core/Providers/ITvDbProvider.cs index 70a852a20..3746389ea 100644 --- a/NzbDrone.Core/Providers/ITvDbProvider.cs +++ b/NzbDrone.Core/Providers/ITvDbProvider.cs @@ -6,6 +6,7 @@ namespace NzbDrone.Core.Providers public interface ITvDbProvider { IList SearchSeries(string name); + int GetBestMatch(List searchResults, string searchString); TvdbSearchResult GetSeries(string title); TvdbSeries GetSeries(int id, bool loadEpisodes); } diff --git a/NzbDrone.Core/Providers/TvDbProvider.cs b/NzbDrone.Core/Providers/TvDbProvider.cs index 5651a5efc..6d5e2fdca 100644 --- a/NzbDrone.Core/Providers/TvDbProvider.cs +++ b/NzbDrone.Core/Providers/TvDbProvider.cs @@ -52,6 +52,23 @@ namespace NzbDrone.Core.Providers return null; } + public int GetBestMatch(List searchResults, string title) + { + if (searchResults.Count == 0) + return 0; + + foreach (var tvdbSearchResult in searchResults) + { + if (IsTitleMatch(tvdbSearchResult.SeriesName, title)) + { + Logger.Debug("Search for '{0}' was successful", title); + return tvdbSearchResult.Id; + } + } + + return searchResults[0].Id; + } + public TvdbSeries GetSeries(int id, bool loadEpisodes) { Logger.Debug("Fetching SeriesId'{0}' from tvdb", id); diff --git a/NzbDrone.Web/Controllers/AddSeriesController.cs b/NzbDrone.Web/Controllers/AddSeriesController.cs index 0f4a4a6c1..d20e2ef26 100644 --- a/NzbDrone.Web/Controllers/AddSeriesController.cs +++ b/NzbDrone.Web/Controllers/AddSeriesController.cs @@ -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); } } diff --git a/NzbDrone.Web/Views/AddSeries/AddExisting.aspx b/NzbDrone.Web/Views/AddSeries/AddExisting.aspx index fab8a8da8..de3aa9c21 100644 --- a/NzbDrone.Web/Views/AddSeries/AddExisting.aspx +++ b/NzbDrone.Web/Views/AddSeries/AddExisting.aspx @@ -7,6 +7,9 @@ <% + if (Model.Count() == 0) + Html.DisplayText("No Series to Add"); + foreach (var path in Model) { Html.RenderAction("RenderPartial", "AddSeries", new { path }); diff --git a/NzbDrone.Web/Views/AddSeries/AddSeriesItem.cshtml b/NzbDrone.Web/Views/AddSeries/AddSeriesItem.cshtml index 7fd70a03c..09458c69f 100644 --- a/NzbDrone.Web/Views/AddSeries/AddSeriesItem.cshtml +++ b/NzbDrone.Web/Views/AddSeries/AddSeriesItem.cshtml @@ -1,6 +1,6 @@ @using NzbDrone.Core.Repository.Quality @model SelectList -
+
@ViewData["path"].ToString()
@@ -11,7 +11,7 @@ .Filterable(f => f.FilterMode(AutoCompleteFilterMode.Contains)) .HighlightFirstMatch(true) .HtmlAttributes(new { style = "width: 300px;" }) - .SelectedIndex(0).Render();} + .Render();} @Html.Telerik().DropDownList().Name("qualityList_" + ViewData["guid"].ToString()).BindTo((SelectList)ViewData["quality"]).HtmlAttributes(new { style = "width: 100px;" }) diff --git a/NzbDrone/app.config b/NzbDrone/app.config index c0e72973b..81d395705 100644 --- a/NzbDrone/app.config +++ b/NzbDrone/app.config @@ -4,6 +4,6 @@ - + \ No newline at end of file