From dc4e45f72df4d48c257aea3186a82b5876a3d67d Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 29 Feb 2012 00:09:53 -0800 Subject: [PATCH] Fix: Fixed an issue with the year automatically being added to new series when added to NzbDrone. --- NzbDrone.Web/Controllers/AddSeriesController.cs | 3 ++- NzbDrone.Web/Models/TvDbSearchResultModel.cs | 1 + NzbDrone.Web/Scripts/NzbDrone/AutoComplete.js | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NzbDrone.Web/Controllers/AddSeriesController.cs b/NzbDrone.Web/Controllers/AddSeriesController.cs index 8ef98a32b..f49ab9f16 100644 --- a/NzbDrone.Web/Controllers/AddSeriesController.cs +++ b/NzbDrone.Web/Controllers/AddSeriesController.cs @@ -177,7 +177,8 @@ public JsonResult LookupSeries(string term) var tvDbResults = _tvDbProvider.SearchSeries(term).Select(r => new TvDbSearchResultModel { Id = r.Id, - Title = r.FirstAired.Year > 1900 + Title = r.SeriesName, + DisplayedTitle = r.FirstAired.Year > 1900 && !r.SeriesName.EndsWith("(" + r.FirstAired.Year + ")") ?string.Format("{0} ({1})", r.SeriesName, r.FirstAired.Year) :r.SeriesName, Banner = r.Banner.BannerPath diff --git a/NzbDrone.Web/Models/TvDbSearchResultModel.cs b/NzbDrone.Web/Models/TvDbSearchResultModel.cs index de0279419..159964958 100644 --- a/NzbDrone.Web/Models/TvDbSearchResultModel.cs +++ b/NzbDrone.Web/Models/TvDbSearchResultModel.cs @@ -7,5 +7,6 @@ public class TvDbSearchResultModel public int Id { get; set; } public string Title { get; set; } public string Banner { get; set; } + public string DisplayedTitle { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/Scripts/NzbDrone/AutoComplete.js b/NzbDrone.Web/Scripts/NzbDrone/AutoComplete.js index 421f20937..57acffdd4 100644 --- a/NzbDrone.Web/Scripts/NzbDrone/AutoComplete.js +++ b/NzbDrone.Web/Scripts/NzbDrone/AutoComplete.js @@ -65,7 +65,7 @@ function bindSeriesAutoComplete(selector) { .data("autocomplete")._renderItem = function (ul, item) { return $("
  • ") .data("item.autocomplete", item) - .append("
    " + item.Title + "
    ") + .append("
    " + item.DisplayedTitle + "
    ") .appendTo(ul); }; });