From 2183526a344ae2fa73a995102f3d00814500ffdc Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 7 Nov 2013 17:02:35 -0800 Subject: [PATCH] New: Show ended on add series if applicable --- src/NzbDrone.Core/MetadataSource/Trakt/FullShow.cs | 1 + src/NzbDrone.Core/MetadataSource/TraktProxy.cs | 14 +++++++++++--- src/UI/AddSeries/SearchResultViewTemplate.html | 9 +++++++-- src/UI/AddSeries/addSeries.less | 7 +++++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/MetadataSource/Trakt/FullShow.cs b/src/NzbDrone.Core/MetadataSource/Trakt/FullShow.cs index bf7745d43..852d36731 100644 --- a/src/NzbDrone.Core/MetadataSource/Trakt/FullShow.cs +++ b/src/NzbDrone.Core/MetadataSource/Trakt/FullShow.cs @@ -25,6 +25,7 @@ namespace NzbDrone.Core.MetadataSource.Trakt public int tvrage_id { get; set; } public int last_updated { get; set; } public string poster { get; set; } + public bool? ended { get; set; } public Images images { get; set; } public List genres { get; set; } public List seasons { get; set; } diff --git a/src/NzbDrone.Core/MetadataSource/TraktProxy.cs b/src/NzbDrone.Core/MetadataSource/TraktProxy.cs index 441f6ee21..1774efed6 100644 --- a/src/NzbDrone.Core/MetadataSource/TraktProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/TraktProxy.cs @@ -78,7 +78,7 @@ namespace NzbDrone.Core.MetadataSource series.Network = show.network; series.AirTime = show.air_time_utc; series.TitleSlug = show.url.ToLower().Replace("http://trakt.tv/show/", ""); - series.Status = GetSeriesStatus(show.status); + series.Status = GetSeriesStatus(show.status, show.ended); series.Seasons = show.seasons.Select(s => new Tv.Season { @@ -114,9 +114,17 @@ namespace NzbDrone.Core.MetadataSource return withoutExtension + "-300" + extension; } - private static SeriesStatusType GetSeriesStatus(string status) + private static SeriesStatusType GetSeriesStatus(string status, bool? ended) { - if (string.IsNullOrWhiteSpace(status)) return SeriesStatusType.Continuing; + if (string.IsNullOrWhiteSpace(status)) + { + if (ended.HasValue && ended.Value) + { + return SeriesStatusType.Ended; + } + + return SeriesStatusType.Continuing; + } if (status.Equals("Ended", StringComparison.InvariantCultureIgnoreCase)) return SeriesStatusType.Ended; return SeriesStatusType.Continuing; } diff --git a/src/UI/AddSeries/SearchResultViewTemplate.html b/src/UI/AddSeries/SearchResultViewTemplate.html index 091c8bb35..5b64b09a9 100644 --- a/src/UI/AddSeries/SearchResultViewTemplate.html +++ b/src/UI/AddSeries/SearchResultViewTemplate.html @@ -1,4 +1,4 @@ -