Fixed airdate parsing. Fixed minor UI issues

This commit is contained in:
Mark McDowall 2013-05-13 20:21:37 -07:00
parent 9d96df9c2e
commit e6183b1f83
11 changed files with 31 additions and 65 deletions

View File

@ -1,19 +1,21 @@
using NzbDrone.Core.Datastore; using NzbDrone.Api.Episodes;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Tv; using NzbDrone.Core.Tv;
namespace NzbDrone.Api.Missing namespace NzbDrone.Api.Missing
{ {
public class MissingModule : NzbDroneRestModule<MissingResource> public class MissingModule : NzbDroneRestModule<EpisodeResource>
{ {
private readonly IEpisodeService _episodeService; private readonly IEpisodeService _episodeService;
public MissingModule(IEpisodeService episodeService) public MissingModule(IEpisodeService episodeService)
:base("missing")
{ {
_episodeService = episodeService; _episodeService = episodeService;
GetResourcePaged = GetMissingEpisodes; GetResourcePaged = GetMissingEpisodes;
} }
private PagingResource<MissingResource> GetMissingEpisodes(PagingResource<MissingResource> pagingResource) private PagingResource<EpisodeResource> GetMissingEpisodes(PagingResource<EpisodeResource> pagingResource)
{ {
var pagingSpec = new PagingSpec<Episode> var pagingSpec = new PagingSpec<Episode>
{ {

View File

@ -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; }
}
}

View File

@ -109,7 +109,6 @@
<Compile Include="Mapping\MappingValidation.cs" /> <Compile Include="Mapping\MappingValidation.cs" />
<Compile Include="Mapping\ResourceMappingException.cs" /> <Compile Include="Mapping\ResourceMappingException.cs" />
<Compile Include="Mapping\ValueInjectorExtensions.cs" /> <Compile Include="Mapping\ValueInjectorExtensions.cs" />
<Compile Include="Missing\MissingResource.cs" />
<Compile Include="Missing\MissingModule.cs" /> <Compile Include="Missing\MissingModule.cs" />
<Compile Include="NzbDroneRestModule.cs" /> <Compile Include="NzbDroneRestModule.cs" />
<Compile Include="PagingResource.cs" /> <Compile Include="PagingResource.cs" />

View File

@ -52,7 +52,7 @@ namespace NzbDrone.Core.MetadataSource
series.TvRageId = show.tvrage_id; series.TvRageId = show.tvrage_id;
series.ImdbId = show.imdb_id; series.ImdbId = show.imdb_id;
series.Title = show.title; series.Title = show.title;
series.FirstAired =FromEpoc(show.first_aired_utc); series.FirstAired = FromIso(show.first_aired_iso);
series.Overview = show.overview; series.Overview = show.overview;
series.Runtime = show.runtime; series.Runtime = show.runtime;
series.Network = show.network; series.Network = show.network;
@ -75,7 +75,7 @@ namespace NzbDrone.Core.MetadataSource
episode.EpisodeNumber = traktEpisode.number; episode.EpisodeNumber = traktEpisode.number;
episode.TvDbEpisodeId = traktEpisode.tvdb_id; episode.TvDbEpisodeId = traktEpisode.tvdb_id;
episode.Title = traktEpisode.title; episode.Title = traktEpisode.title;
episode.AirDate =FromEpoc(traktEpisode.first_aired_utc); episode.AirDate = FromIso(traktEpisode.first_aired_iso);
return episode; return episode;
} }
@ -96,11 +96,21 @@ namespace NzbDrone.Core.MetadataSource
return SeriesStatusType.Continuing; return SeriesStatusType.Continuing;
} }
private static DateTime? FromEpoc(long ticks) private static DateTime? FromEpoch(long ticks)
{ {
if (ticks == 0) return null; 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();
} }
} }
} }

View File

@ -42,13 +42,7 @@ define(['app', 'Shared/ModalRegion', 'AddSeries/AddSeriesLayout',
settings: function (action) { settings: function (action) {
this._setTitle('Settings'); this._setTitle('Settings');
NzbDrone.mainRegion.show(new NzbDrone.Settings.SettingsLayout({action: action}));
var settingsModel = new NzbDrone.Settings.SettingsModel();
settingsModel.fetch({
success: function (settings) {
NzbDrone.mainRegion.show(new NzbDrone.Settings.SettingsLayout({settings: settings, action: action}));
}
});
}, },
missing: function () { missing: function () {

View File

@ -20,7 +20,7 @@
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<a href="/series/details/{{id}}" target="_blank"> <a href="/series/details/{{id}}">
<div class="span10"> <div class="span10">
{{overview}} {{overview}}
</div> </div>
@ -33,11 +33,11 @@
{{#if bestDateString}} {{#if bestDateString}}
<span class="label">{{bestDateString}}</span> <span class="label">{{bestDateString}}</span>
{{else}} {{else}}
<span class="label label-inverse">{{status}}</span> <span class="label label-inverse">Continuing</span>
{{/if}} {{/if}}
<span class="label label-info">Season {{seasonCount}}</span> <span class="label label-info">Season {{seasonCount}}</span>
{{else}} {{else}}
<span class="label label-important">{{status}}</span> <span class="label label-important">Ended</span>
<span class="label label-info">{{seasonCount}} Seasons</span> <span class="label label-info">{{seasonCount}} Seasons</span>
{{/if}} {{/if}}
</div> </div>

View File

@ -4,15 +4,13 @@
<div class="center"> <div class="center">
<div class="series-poster-container x-series-poster"> <div class="series-poster-container x-series-poster">
<div class="series-controls"> <div class="series-controls">
<!--<div class="pull-right">-->
<i class="icon-cog x-edit" title="Edit Series"></i> <i class="icon-cog x-edit" title="Edit Series"></i>
<i class="icon-remove x-remove" title="Delete Series"></i> <i class="icon-remove x-remove" title="Delete Series"></i>
<!--</div>-->
</div> </div>
{{#unless isContinuing}} {{#unless isContinuing}}
<div class="ended-banner">Ended</div> <div class="ended-banner">Ended</div>
{{/unless}} {{/unless}}
<a href="/series/details/{{titleSlug}}" target="_blank"> <a href="/series/details/{{titleSlug}}">
<img class="series-poster img-polaroid" src="{{poster}}"> <img class="series-poster img-polaroid" src="{{poster}}">
</a> </a>
</div> </div>
@ -26,7 +24,7 @@
{{#if bestDateString}} {{#if bestDateString}}
<span class="label label-inverse air-date" title="{{shortDate}}">{{bestDateString}}</span> <span class="label label-inverse air-date" title="{{shortDate}}">{{bestDateString}}</span>
{{else}} {{else}}
<span class="label label-inverse">{{status}}</span> <span class="label label-inverse">Continuing</span>
{{/if}} {{/if}}
<span class="label label-info">Season {{seasonCount}}</span> <span class="label label-info">Season {{seasonCount}}</span>
{{else}} {{else}}

View File

@ -10,7 +10,7 @@ Backgrid.SeriesStatusCell = Backgrid.Cell.extend({
if (!monitored) { if (!monitored) {
this.$el.html('<i class="icon-pause grid-icon" title="Not Monitored"></i>'); this.$el.html('<i class="icon-pause grid-icon" title="Not Monitored"></i>');
} }
else if (status === 0) { else if (status === 'continuing') {
this.$el.html('<i class="icon-play grid-icon" title="Continuing"></i>'); this.$el.html('<i class="icon-play grid-icon" title="Continuing"></i>');
} }

View File

@ -75,8 +75,5 @@ define([
throw "unknown download client id" + clientId; throw "unknown download client id" + clientId;
} }
} }
}); });
}); });

View File

@ -21,8 +21,6 @@
</div> </div>
</div> </div>
{{debug}}
{{#each fields}} {{#each fields}}
<div class="control-group"> <div class="control-group">
<label class="control-label">{{label}}</label> <label class="control-label">{{label}}</label>

View File

@ -108,7 +108,9 @@ define([
}, },
initialize: function (options) { 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 = new NzbDrone.Settings.Naming.NamingModel();
this.namingSettings.fetch(); this.namingSettings.fetch();