From 21e9bad6d5c26cefa7cf47afd1d7a6e970b36db8 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Mon, 20 May 2013 14:05:48 -0700 Subject: [PATCH] removed episode status from server. --- NzbDrone.Api/Episodes/EpisodeResource.cs | 4 -- NzbDrone.Core.Test/EpisodeStatusTest.cs | 47 ------------------ NzbDrone.Core.Test/NzbDrone.Core.Test.csproj | 1 - NzbDrone.Core/Model/PostDownloadStatusType.cs | 12 ----- NzbDrone.Core/NzbDrone.Core.csproj | 2 - NzbDrone.Core/Tv/Episode.cs | 16 ------- NzbDrone.Core/Tv/EpisodeStatuses.cs | 48 ------------------- ...sodeDetailCell.js => EpisodeStatusCell.js} | 16 ++++++- 8 files changed, 14 insertions(+), 132 deletions(-) delete mode 100644 NzbDrone.Core.Test/EpisodeStatusTest.cs delete mode 100644 NzbDrone.Core/Model/PostDownloadStatusType.cs delete mode 100644 NzbDrone.Core/Tv/EpisodeStatuses.cs rename UI/Series/Details/{EpisodeDetailCell.js => EpisodeStatusCell.js} (56%) diff --git a/NzbDrone.Api/Episodes/EpisodeResource.cs b/NzbDrone.Api/Episodes/EpisodeResource.cs index 2290eb729..e323ea241 100644 --- a/NzbDrone.Api/Episodes/EpisodeResource.cs +++ b/NzbDrone.Api/Episodes/EpisodeResource.cs @@ -1,8 +1,6 @@ using System; using NzbDrone.Api.REST; using NzbDrone.Core.MediaFiles; -using NzbDrone.Core.Model; -using NzbDrone.Core.Tv; namespace NzbDrone.Api.Episodes { @@ -15,7 +13,6 @@ public class EpisodeResource : RestResource public Int32 EpisodeNumber { get; set; } public String Title { get; set; } public DateTime? AirDate { get; set; } - public EpisodeStatuses Status { get; set; } public String Overview { get; set; } public EpisodeFile EpisodeFile { get; set; } @@ -27,7 +24,6 @@ public class EpisodeResource : RestResource public Int32? AbsoluteEpisodeNumber { get; set; } public DateTime? EndTime { get; set; } public DateTime? GrabDate { get; set; } - public PostDownloadStatusType PostDownloadStatus { get; set; } public Core.Tv.Series Series { get; set; } public String SeriesTitle { get; set; } } diff --git a/NzbDrone.Core.Test/EpisodeStatusTest.cs b/NzbDrone.Core.Test/EpisodeStatusTest.cs deleted file mode 100644 index 2b4d589f2..000000000 --- a/NzbDrone.Core.Test/EpisodeStatusTest.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; -using FizzWare.NBuilder; -using FluentAssertions; -using NUnit.Framework; -using NzbDrone.Core.MediaFiles; -using NzbDrone.Core.Tv; -using NzbDrone.Core.Model; - -using NzbDrone.Core.Test.Framework; - -namespace NzbDrone.Core.Test -{ - [TestFixture] - - public class EpisodeStatusTest : CoreTest - { - [TestCase(1, true, true, EpisodeStatuses.Ready)] - public void ignored_episode(int offsetDays, bool ignored, bool hasEpisodes, EpisodeStatuses status) - { - Episode episode = Builder.CreateNew() - .With(e => e.AirDate = DateTime.Now.AddDays(offsetDays)) - .With(e => e.Ignored = ignored) - .Build(); - - if (hasEpisodes) - { - episode.EpisodeFile = new EpisodeFile(); - } - - episode.Status.Should().Be(status); - - } - - [Test] - public void low_air_date() - { - Episode episode = Builder.CreateNew() - .With(e => e.AirDate = DateTime.Now.AddDays(20)) - .With(e => e.Ignored = false) - .With(e => e.EpisodeFileId = 0) - .Build(); - - - episode.Status.Should().Be(EpisodeStatuses.NotAired); - } - } -} \ No newline at end of file diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index ada85977a..716666123 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -193,7 +193,6 @@ - diff --git a/NzbDrone.Core/Model/PostDownloadStatusType.cs b/NzbDrone.Core/Model/PostDownloadStatusType.cs deleted file mode 100644 index 3d170cd4e..000000000 --- a/NzbDrone.Core/Model/PostDownloadStatusType.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace NzbDrone.Core.Model -{ - public enum PostDownloadStatusType - { - Unknown = 0, - Unpacking = 1, - Failed = 2, - UnknownSeries = 3, - ParseError = 4, - NoError = 5, - } -} \ No newline at end of file diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index a27d9a8cc..9a04907ce 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -336,7 +336,6 @@ - @@ -351,7 +350,6 @@ - diff --git a/NzbDrone.Core/Tv/Episode.cs b/NzbDrone.Core/Tv/Episode.cs index 962459a11..1fc1be20f 100644 --- a/NzbDrone.Core/Tv/Episode.cs +++ b/NzbDrone.Core/Tv/Episode.cs @@ -28,22 +28,6 @@ public bool HasFile get { return EpisodeFileId != 0; } } - public EpisodeStatuses Status - { - get - { - if (HasFile) return EpisodeStatuses.Ready; - - if (AirDate != null && AirDate.Value.Date == DateTime.Today) - return EpisodeStatuses.AirsToday; - - if (AirDate != null && AirDate.Value.Date < DateTime.Now) - return EpisodeStatuses.Missing; - - return EpisodeStatuses.NotAired; - } - } - public String SeriesTitle { get; private set; } public Series Series { get; set; } diff --git a/NzbDrone.Core/Tv/EpisodeStatuses.cs b/NzbDrone.Core/Tv/EpisodeStatuses.cs deleted file mode 100644 index 0098daa5d..000000000 --- a/NzbDrone.Core/Tv/EpisodeStatuses.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace NzbDrone.Core.Tv -{ - public enum EpisodeStatuses - { - /// - /// Episode has not aired yet - /// - NotAired, - - /// - /// Episode is ignored - /// - Ignored, - - /// - /// Episode has aired, but no episode - /// files are available - /// Todo: We shouldn't set missing until the episode has past the actual airtime + runtime, including UtcOffset - /// - Missing, - - /// - /// Episode airs today, but no episode - /// files are available - /// - AirsToday, - - /// - /// Episode is being downloaded - /// - Downloading, - - /// - /// Episode has been downloaded and is unpacking (_UNPACK_) - /// - Unpacking, - - /// - /// Episode has failed to download properly (_FAILED_) - /// - Failed, - - /// - /// Episode is present in disk - /// - Ready - } -} \ No newline at end of file diff --git a/UI/Series/Details/EpisodeDetailCell.js b/UI/Series/Details/EpisodeStatusCell.js similarity index 56% rename from UI/Series/Details/EpisodeDetailCell.js rename to UI/Series/Details/EpisodeStatusCell.js index 2c64e9332..00c5679f5 100644 --- a/UI/Series/Details/EpisodeDetailCell.js +++ b/UI/Series/Details/EpisodeStatusCell.js @@ -1,14 +1,26 @@ "use strict"; define(['app', 'Episode/Layout'], function () { - NzbDrone.Series.Details.EpisodeDetailCell = Backgrid.Cell.extend({ + NzbDrone.Series.Details.EpisodeStatusCell = Backgrid.Cell.extend({ events: { 'click': 'showDetails' }, render: function () { this.$el.empty(); - this.$el.html(''); + + if (this.model) { + + var icon; + + if (this.model.get('episodeFile')) { + icon = 'icon-ok'; + + } + + this.$el.html(''.format(icon)); + } + return this; },