1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

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;
namespace NzbDrone.Api.Missing
{
public class MissingModule : NzbDroneRestModule<MissingResource>
public class MissingModule : NzbDroneRestModule<EpisodeResource>
{
private readonly IEpisodeService _episodeService;
public MissingModule(IEpisodeService episodeService)
:base("missing")
{
_episodeService = episodeService;
GetResourcePaged = GetMissingEpisodes;
}
private PagingResource<MissingResource> GetMissingEpisodes(PagingResource<MissingResource> pagingResource)
private PagingResource<EpisodeResource> GetMissingEpisodes(PagingResource<EpisodeResource> pagingResource)
{
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\ResourceMappingException.cs" />
<Compile Include="Mapping\ValueInjectorExtensions.cs" />
<Compile Include="Missing\MissingResource.cs" />
<Compile Include="Missing\MissingModule.cs" />
<Compile Include="NzbDroneRestModule.cs" />
<Compile Include="PagingResource.cs" />

View File

@ -52,7 +52,7 @@ private static Series MapSeries(Show show)
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 @@ private static Episode MapEpisode(Trakt.Episode traktEpisode)
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 @@ private static SeriesStatusType GetSeriesStatus(string status)
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();
}
}
}

View File

@ -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 () {

View File

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

View File

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

View File

@ -10,7 +10,7 @@ Backgrid.SeriesStatusCell = Backgrid.Cell.extend({
if (!monitored) {
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>');
}

View File

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

View File

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

View File

@ -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();