From e6183b1f83fa76fafb3ddfa28bbed46da167d249 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Mon, 13 May 2013 20:21:37 -0700 Subject: [PATCH] Fixed airdate parsing. Fixed minor UI issues --- NzbDrone.Api/Missing/MissingModule.cs | 8 +++-- NzbDrone.Api/Missing/MissingResource.cs | 34 ------------------- NzbDrone.Api/NzbDrone.Api.csproj | 1 - NzbDrone.Core/MetadataSource/TraktProxy.cs | 18 +++++++--- UI/Controller.js | 8 +---- UI/Series/Index/List/ItemTemplate.html | 6 ++-- UI/Series/Index/Posters/ItemTemplate.html | 10 +++--- UI/Series/Index/Table/SeriesStatusCell.js | 2 +- .../DownloadClient/DownloadClientView.js | 3 -- UI/Settings/Indexers/ItemTemplate.html | 2 -- UI/Settings/SettingsLayout.js | 4 ++- 11 files changed, 31 insertions(+), 65 deletions(-) delete mode 100644 NzbDrone.Api/Missing/MissingResource.cs diff --git a/NzbDrone.Api/Missing/MissingModule.cs b/NzbDrone.Api/Missing/MissingModule.cs index 22673c2ab..8527284c5 100644 --- a/NzbDrone.Api/Missing/MissingModule.cs +++ b/NzbDrone.Api/Missing/MissingModule.cs @@ -1,19 +1,21 @@ -using NzbDrone.Core.Datastore; +using NzbDrone.Api.Episodes; +using NzbDrone.Core.Datastore; using NzbDrone.Core.Tv; namespace NzbDrone.Api.Missing { - public class MissingModule : NzbDroneRestModule + public class MissingModule : NzbDroneRestModule { private readonly IEpisodeService _episodeService; public MissingModule(IEpisodeService episodeService) + :base("missing") { _episodeService = episodeService; GetResourcePaged = GetMissingEpisodes; } - private PagingResource GetMissingEpisodes(PagingResource pagingResource) + private PagingResource GetMissingEpisodes(PagingResource pagingResource) { var pagingSpec = new PagingSpec { diff --git a/NzbDrone.Api/Missing/MissingResource.cs b/NzbDrone.Api/Missing/MissingResource.cs deleted file mode 100644 index 11bd7704b..000000000 --- a/NzbDrone.Api/Missing/MissingResource.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using NzbDrone.Api.REST; -using NzbDrone.Core.MediaFiles; -using NzbDrone.Core.Model; -using NzbDrone.Core.Tv; - -namespace NzbDrone.Api.Missing -{ - public class MissingResource : RestResource - { - public Int32 Id { get; set; } - public Int32 SeriesId { get; set; } - public Int32 EpisodeFileId { get; set; } - public Int32 SeasonNumber { get; set; } - 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; } - - public Boolean HasFile { get; set; } - public Boolean Ignored { get; set; } - public Int32 SceneEpisodeNumber { get; set; } - public Int32 SceneSeasonNumber { get; set; } - public Int32 TvDbEpisodeId { get; set; } - 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.Api/NzbDrone.Api.csproj b/NzbDrone.Api/NzbDrone.Api.csproj index 1e08e4fc1..7694cf32b 100644 --- a/NzbDrone.Api/NzbDrone.Api.csproj +++ b/NzbDrone.Api/NzbDrone.Api.csproj @@ -109,7 +109,6 @@ - diff --git a/NzbDrone.Core/MetadataSource/TraktProxy.cs b/NzbDrone.Core/MetadataSource/TraktProxy.cs index 96763657c..38d956ce6 100644 --- a/NzbDrone.Core/MetadataSource/TraktProxy.cs +++ b/NzbDrone.Core/MetadataSource/TraktProxy.cs @@ -52,7 +52,7 @@ namespace NzbDrone.Core.MetadataSource series.TvRageId = show.tvrage_id; series.ImdbId = show.imdb_id; series.Title = show.title; - series.FirstAired =FromEpoc(show.first_aired_utc); + series.FirstAired = FromIso(show.first_aired_iso); series.Overview = show.overview; series.Runtime = show.runtime; series.Network = show.network; @@ -75,7 +75,7 @@ namespace NzbDrone.Core.MetadataSource episode.EpisodeNumber = traktEpisode.number; episode.TvDbEpisodeId = traktEpisode.tvdb_id; episode.Title = traktEpisode.title; - episode.AirDate =FromEpoc(traktEpisode.first_aired_utc); + episode.AirDate = FromIso(traktEpisode.first_aired_iso); return episode; } @@ -96,11 +96,21 @@ namespace NzbDrone.Core.MetadataSource return SeriesStatusType.Continuing; } - private static DateTime? FromEpoc(long ticks) + private static DateTime? FromEpoch(long ticks) { if (ticks == 0) return null; - return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(ticks); + return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(ticks); + } + + private static DateTime? FromIso(string iso) + { + DateTime result; + + if (!DateTime.TryParse(iso, out result)) + return null; + + return result.ToUniversalTime(); } } } \ No newline at end of file diff --git a/UI/Controller.js b/UI/Controller.js index 3516e136d..8312cc968 100644 --- a/UI/Controller.js +++ b/UI/Controller.js @@ -42,13 +42,7 @@ define(['app', 'Shared/ModalRegion', 'AddSeries/AddSeriesLayout', settings: function (action) { this._setTitle('Settings'); - - var settingsModel = new NzbDrone.Settings.SettingsModel(); - settingsModel.fetch({ - success: function (settings) { - NzbDrone.mainRegion.show(new NzbDrone.Settings.SettingsLayout({settings: settings, action: action})); - } - }); + NzbDrone.mainRegion.show(new NzbDrone.Settings.SettingsLayout({action: action})); }, missing: function () { diff --git a/UI/Series/Index/List/ItemTemplate.html b/UI/Series/Index/List/ItemTemplate.html index a32253d72..6aa01aba2 100644 --- a/UI/Series/Index/List/ItemTemplate.html +++ b/UI/Series/Index/List/ItemTemplate.html @@ -20,7 +20,7 @@ diff --git a/UI/Series/Index/Posters/ItemTemplate.html b/UI/Series/Index/Posters/ItemTemplate.html index 67eda5628..de40085e8 100644 --- a/UI/Series/Index/Posters/ItemTemplate.html +++ b/UI/Series/Index/Posters/ItemTemplate.html @@ -4,15 +4,13 @@
@@ -26,7 +24,7 @@ {{#if bestDateString}} {{bestDateString}} {{else}} - {{status}} + Continuing {{/if}} Season {{seasonCount}} {{else}} diff --git a/UI/Series/Index/Table/SeriesStatusCell.js b/UI/Series/Index/Table/SeriesStatusCell.js index 16addb5fa..1dd569d4c 100644 --- a/UI/Series/Index/Table/SeriesStatusCell.js +++ b/UI/Series/Index/Table/SeriesStatusCell.js @@ -10,7 +10,7 @@ Backgrid.SeriesStatusCell = Backgrid.Cell.extend({ if (!monitored) { this.$el.html(''); } - else if (status === 0) { + else if (status === 'continuing') { this.$el.html(''); } diff --git a/UI/Settings/DownloadClient/DownloadClientView.js b/UI/Settings/DownloadClient/DownloadClientView.js index ea7cfd409..9f31d48d4 100644 --- a/UI/Settings/DownloadClient/DownloadClientView.js +++ b/UI/Settings/DownloadClient/DownloadClientView.js @@ -75,8 +75,5 @@ define([ throw "unknown download client id" + clientId; } } - - - }); }); diff --git a/UI/Settings/Indexers/ItemTemplate.html b/UI/Settings/Indexers/ItemTemplate.html index 0a73bf2b5..3cc96a821 100644 --- a/UI/Settings/Indexers/ItemTemplate.html +++ b/UI/Settings/Indexers/ItemTemplate.html @@ -21,8 +21,6 @@
- {{debug}} - {{#each fields}}
diff --git a/UI/Settings/SettingsLayout.js b/UI/Settings/SettingsLayout.js index 4a3e6da9f..3195f373e 100644 --- a/UI/Settings/SettingsLayout.js +++ b/UI/Settings/SettingsLayout.js @@ -108,7 +108,9 @@ define([ }, initialize: function (options) { - this.settings = options.settings; + this.settings = new NzbDrone.Settings.SettingsModel(); + this.settings.fetch(); + this.namingSettings = new NzbDrone.Settings.Naming.NamingModel(); this.namingSettings.fetch();