mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-12 14:03:16 +01:00
Added AirDateUtc for UTC offset time
This commit is contained in:
parent
7689b50dee
commit
eb5a15a8ca
@ -12,6 +12,7 @@ public class EpisodeResource : RestResource
|
|||||||
public Int32 EpisodeNumber { get; set; }
|
public Int32 EpisodeNumber { get; set; }
|
||||||
public String Title { get; set; }
|
public String Title { get; set; }
|
||||||
public DateTime? AirDate { get; set; }
|
public DateTime? AirDate { get; set; }
|
||||||
|
public DateTime? AirDateUtc { get; set; }
|
||||||
public String Overview { get; set; }
|
public String Overview { get; set; }
|
||||||
public EpisodeFile EpisodeFile { get; set; }
|
public EpisodeFile EpisodeFile { get; set; }
|
||||||
|
|
||||||
|
@ -22,7 +22,6 @@ public class SeriesResource : RestResource
|
|||||||
public DateTime? NextAiring { get; set; }
|
public DateTime? NextAiring { get; set; }
|
||||||
public String Network { get; set; }
|
public String Network { get; set; }
|
||||||
public String AirTime { get; set; }
|
public String AirTime { get; set; }
|
||||||
public Int32 UtcOffset { get; set; }
|
|
||||||
public List<Core.MediaCover.MediaCover> Images { get; set; }
|
public List<Core.MediaCover.MediaCover> Images { get; set; }
|
||||||
|
|
||||||
public String RemotePoster { get; set; }
|
public String RemotePoster { get; set; }
|
||||||
|
17
NzbDrone.Core/Datastore/Migration/013_add_air_date_utc.cs
Normal file
17
NzbDrone.Core/Datastore/Migration/013_add_air_date_utc.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Tags("")]
|
||||||
|
[Migration(13)]
|
||||||
|
public class add_air_date_utc : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Alter.Table("Episodes").AddColumn("AirDateUtc").AsDateTime().Nullable();
|
||||||
|
|
||||||
|
Execute.Sql("UPDATE Episodes SET AirDateUtc = AirDate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -69,7 +69,8 @@ private static Episode MapEpisode(Trakt.Episode traktEpisode)
|
|||||||
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 = FromIso(traktEpisode.first_aired_iso);
|
episode.AirDate = FromEpoch(traktEpisode.first_aired);
|
||||||
|
episode.AirDateUtc = FromIso(traktEpisode.first_aired_iso);
|
||||||
|
|
||||||
return episode;
|
return episode;
|
||||||
}
|
}
|
||||||
|
@ -213,6 +213,7 @@
|
|||||||
<Compile Include="Datastore\Migration\010_add_monitored.cs" />
|
<Compile Include="Datastore\Migration\010_add_monitored.cs" />
|
||||||
<Compile Include="Datastore\Migration\011_remove_ignored.cs" />
|
<Compile Include="Datastore\Migration\011_remove_ignored.cs" />
|
||||||
<Compile Include="Datastore\Migration\012_remove_custom_start_date.cs" />
|
<Compile Include="Datastore\Migration\012_remove_custom_start_date.cs" />
|
||||||
|
<Compile Include="Datastore\Migration\013_add_air_date_utc.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
||||||
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />
|
<Compile Include="Datastore\Migration\Framework\MigrationExtension.cs" />
|
||||||
|
@ -17,7 +17,7 @@ public class RemoteEpisode
|
|||||||
|
|
||||||
public bool IsRecentEpisode()
|
public bool IsRecentEpisode()
|
||||||
{
|
{
|
||||||
return Episodes.Any(e => e.AirDate >= DateTime.Today.AddDays(-14));
|
return Episodes.Any(e => e.AirDateUtc >= DateTime.Today.AddDays(-14));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,6 +16,7 @@ public class Episode : ModelBase
|
|||||||
public int EpisodeNumber { get; set; }
|
public int EpisodeNumber { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public DateTime? AirDate { get; set; }
|
public DateTime? AirDate { get; set; }
|
||||||
|
public DateTime? AirDateUtc { get; set; }
|
||||||
|
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
public Boolean Monitored { get; set; }
|
public Boolean Monitored { get; set; }
|
||||||
|
@ -106,8 +106,8 @@ public List<Episode> EpisodesWithFiles()
|
|||||||
public List<Episode> EpisodesBetweenDates(DateTime startDate, DateTime endDate)
|
public List<Episode> EpisodesBetweenDates(DateTime startDate, DateTime endDate)
|
||||||
{
|
{
|
||||||
return Query.Join<Episode, Series>(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id)
|
return Query.Join<Episode, Series>(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id)
|
||||||
.Where<Episode>(e => e.AirDate >= startDate)
|
.Where<Episode>(e => e.AirDateUtc >= startDate)
|
||||||
.AndWhere(e => e.AirDate <= endDate)
|
.AndWhere(e => e.AirDateUtc <= endDate)
|
||||||
.AndWhere(e => e.Monitored)
|
.AndWhere(e => e.Monitored)
|
||||||
.AndWhere(e => e.Series.Monitored)
|
.AndWhere(e => e.Series.Monitored)
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -145,7 +145,7 @@ private SortBuilder<Episode> GetEpisodesWithoutFilesQuery(PagingSpec<Episode> pa
|
|||||||
return Query.Join<Episode, Series>(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id)
|
return Query.Join<Episode, Series>(JoinType.Inner, e => e.Series, (e, s) => e.SeriesId == s.Id)
|
||||||
.Where(e => e.EpisodeFileId == 0)
|
.Where(e => e.EpisodeFileId == 0)
|
||||||
.AndWhere(e => e.SeasonNumber >= startingSeasonNumber)
|
.AndWhere(e => e.SeasonNumber >= startingSeasonNumber)
|
||||||
.AndWhere(e => e.AirDate <= currentTime)
|
.AndWhere(e => e.AirDateUtc <= currentTime)
|
||||||
.AndWhere(e => e.Monitored)
|
.AndWhere(e => e.Monitored)
|
||||||
.AndWhere(e => e.Series.Monitored)
|
.AndWhere(e => e.Series.Monitored)
|
||||||
.OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection())
|
.OrderBy(pagingSpec.OrderByClause(), pagingSpec.ToSortDirection())
|
||||||
|
@ -148,6 +148,7 @@ private void RefreshEpisodeInfo(Series series, IEnumerable<Episode> remoteEpisod
|
|||||||
episodeToUpdate.Title = episode.Title;
|
episodeToUpdate.Title = episode.Title;
|
||||||
episodeToUpdate.Overview = episode.Overview;
|
episodeToUpdate.Overview = episode.Overview;
|
||||||
episodeToUpdate.AirDate = episode.AirDate;
|
episodeToUpdate.AirDate = episode.AirDate;
|
||||||
|
episodeToUpdate.AirDateUtc = episode.AirDateUtc;
|
||||||
|
|
||||||
successCount++;
|
successCount++;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ define(
|
|||||||
_.each(calendarCollection.models, function (element) {
|
_.each(calendarCollection.models, function (element) {
|
||||||
var episodeTitle = element.get('title');
|
var episodeTitle = element.get('title');
|
||||||
var seriesTitle = element.get('series').get('title');
|
var seriesTitle = element.get('series').get('title');
|
||||||
var start = element.get('airDate');
|
var start = element.get('airDateUtc');
|
||||||
var statusLevel = _instance.getStatusLevel(element);
|
var statusLevel = _instance.getStatusLevel(element);
|
||||||
|
|
||||||
element.set({
|
element.set({
|
||||||
@ -80,7 +80,7 @@ define(
|
|||||||
getStatusLevel: function (element) {
|
getStatusLevel: function (element) {
|
||||||
var hasFile = element.get('hasFile');
|
var hasFile = element.get('hasFile');
|
||||||
var currentTime = Moment();
|
var currentTime = Moment();
|
||||||
var start = Moment(element.get('airDate'));
|
var start = Moment(element.get('airDateUtc'));
|
||||||
var end = Moment(element.get('end'));
|
var end = Moment(element.get('end'));
|
||||||
|
|
||||||
var statusLevel = 'primary';
|
var statusLevel = 'primary';
|
||||||
|
@ -9,7 +9,7 @@ define(
|
|||||||
model: EpisodeModel,
|
model: EpisodeModel,
|
||||||
|
|
||||||
comparator: function (model) {
|
comparator: function (model) {
|
||||||
var date = new Date(model.get('airDate'));
|
var date = new Date(model.get('airDateUtc'));
|
||||||
var time = date.getTime();
|
var time = date.getTime();
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,11 @@ define(
|
|||||||
model: EpisodeModel,
|
model: EpisodeModel,
|
||||||
|
|
||||||
comparator: function (model1, model2) {
|
comparator: function (model1, model2) {
|
||||||
var airDate1 = model1.get('airDate');
|
var airDate1 = model1.get('airDateUtc');
|
||||||
var date1 = Moment(airDate1);
|
var date1 = Moment(airDate1);
|
||||||
var time1 = date1.unix();
|
var time1 = date1.unix();
|
||||||
|
|
||||||
var airDate2 = model2.get('airDate');
|
var airDate2 = model2.get('airDateUtc');
|
||||||
var date2 = Moment(airDate2);
|
var date2 = Moment(airDate2);
|
||||||
var time2 = date2.unix();
|
var time2 = date2.unix();
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
<div class="event">
|
<div class="event">
|
||||||
<div class="date {{StatusLevel}}">
|
<div class="date {{StatusLevel}}">
|
||||||
<h1>{{Day airDate}}</h1>
|
<h1>{{Day airDateUtc}}</h1>
|
||||||
<h4>{{Month airDate}}</h4>
|
<h4>{{Month airDateUtc}}</h4>
|
||||||
</div>
|
</div>
|
||||||
{{#with series}}
|
{{#with series}}
|
||||||
<a href="{{route}}">
|
<a href="{{route}}">
|
||||||
<h4>{{title}}</h4>
|
<h4>{{title}}</h4>
|
||||||
</a>
|
</a>
|
||||||
{{/with}}
|
{{/with}}
|
||||||
<p>{{StartTime airDate}} {{ShortDate airDate}}<span class="pull-right">{{seasonNumber}}x{{Pad2 episodeNumber}}</span><br>{{episodeTitle}}</p>
|
<p>{{StartTime airDateUtc}} {{ShortDate airDateUtc}}<span class="pull-right">{{seasonNumber}}x{{Pad2 episodeNumber}}</span><br>{{episodeTitle}}</p>
|
||||||
<p class="episode-title x-episode-title">{{title}}</p>
|
<p class="episode-title x-episode-title">{{title}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,7 +13,7 @@ define(
|
|||||||
|
|
||||||
this.$el.empty();
|
this.$el.empty();
|
||||||
|
|
||||||
var airDateField = this.column.get('airDate') || 'airDate';
|
var airDateField = this.column.get('airDateUtc') || 'airDateUtc';
|
||||||
var seasonField = this.column.get('seasonNumber') || 'seasonNumber';
|
var seasonField = this.column.get('seasonNumber') || 'seasonNumber';
|
||||||
var episodeField = this.column.get('episodes') || 'episodeNumber';
|
var episodeField = this.column.get('episodes') || 'episodeNumber';
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ define(
|
|||||||
Handlebars.registerHelper('EpisodeNumber', function () {
|
Handlebars.registerHelper('EpisodeNumber', function () {
|
||||||
|
|
||||||
if (this.series.seriesType === 'daily') {
|
if (this.series.seriesType === 'daily') {
|
||||||
return Moment(this.airDate).format('L');
|
return Moment(this.airDateUtc).format('L');
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
@ -21,7 +21,7 @@ define(
|
|||||||
|
|
||||||
var hasFile = this.hasFile;
|
var hasFile = this.hasFile;
|
||||||
var currentTime = Moment();
|
var currentTime = Moment();
|
||||||
var start = Moment(this.airDate);
|
var start = Moment(this.airDateUtc);
|
||||||
var end = Moment(this.end);
|
var end = Moment(this.end);
|
||||||
|
|
||||||
if (currentTime.isAfter(start) && currentTime.isBefore(end)) {
|
if (currentTime.isAfter(start) && currentTime.isBefore(end)) {
|
||||||
|
@ -10,7 +10,7 @@ define(
|
|||||||
|
|
||||||
state: {
|
state: {
|
||||||
pageSize: 15,
|
pageSize: 15,
|
||||||
sortKey : 'airDate',
|
sortKey : 'airDateUtc',
|
||||||
order : 1
|
order : 1
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ define(
|
|||||||
sortable: false
|
sortable: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name : 'airDate',
|
name : 'airDateUtc',
|
||||||
label: 'Air Date',
|
label: 'Air Date',
|
||||||
cell : AirDateCell
|
cell : AirDateCell
|
||||||
} ,
|
} ,
|
||||||
|
@ -9,7 +9,7 @@ define(
|
|||||||
|
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
if (this.has('series')) {
|
if (this.has('series')) {
|
||||||
var start = Moment(this.get('airDate'));
|
var start = Moment(this.get('airDateUtc'));
|
||||||
var runtime = this.get('series').get('runtime');
|
var runtime = this.get('series').get('runtime');
|
||||||
|
|
||||||
this.set('end', start.add('minutes', runtime));
|
this.set('end', start.add('minutes', runtime));
|
||||||
|
Loading…
Reference in New Issue
Block a user