parent
df2e867528
commit
076aaba908
|
@ -190,7 +190,7 @@ class SeriesDetails extends Component {
|
||||||
genres,
|
genres,
|
||||||
tags,
|
tags,
|
||||||
year,
|
year,
|
||||||
previousAiring,
|
lastAired,
|
||||||
isSaving,
|
isSaving,
|
||||||
isRefreshing,
|
isRefreshing,
|
||||||
isSearching,
|
isSearching,
|
||||||
|
@ -227,7 +227,7 @@ class SeriesDetails extends Component {
|
||||||
} = this.state;
|
} = this.state;
|
||||||
|
|
||||||
const statusDetails = getSeriesStatusDetails(status);
|
const statusDetails = getSeriesStatusDetails(status);
|
||||||
const runningYears = statusDetails.title === translate('Ended') ? `${year}-${getDateYear(previousAiring)}` : `${year}-`;
|
const runningYears = statusDetails.title === translate('Ended') ? `${year}-${getDateYear(lastAired)}` : `${year}-`;
|
||||||
|
|
||||||
let episodeFilesCountMessage = translate('SeriesDetailsNoEpisodeFiles');
|
let episodeFilesCountMessage = translate('SeriesDetailsNoEpisodeFiles');
|
||||||
|
|
||||||
|
@ -711,6 +711,7 @@ SeriesDetails.propTypes = {
|
||||||
genres: PropTypes.arrayOf(PropTypes.string).isRequired,
|
genres: PropTypes.arrayOf(PropTypes.string).isRequired,
|
||||||
tags: PropTypes.arrayOf(PropTypes.number).isRequired,
|
tags: PropTypes.arrayOf(PropTypes.number).isRequired,
|
||||||
year: PropTypes.number.isRequired,
|
year: PropTypes.number.isRequired,
|
||||||
|
lastAired: PropTypes.string,
|
||||||
previousAiring: PropTypes.string,
|
previousAiring: PropTypes.string,
|
||||||
isSaving: PropTypes.bool.isRequired,
|
isSaving: PropTypes.bool.isRequired,
|
||||||
saveError: PropTypes.object,
|
saveError: PropTypes.object,
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(199)]
|
||||||
|
public class series_last_aired : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Alter.Table("Series").AddColumn("LastAired").AsDateTimeOffset().Nullable();
|
||||||
|
|
||||||
|
// Execute.Sql("UPDATE Series SET LastAired = ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -20,6 +20,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
|
||||||
// public string Language { get; set; }
|
// public string Language { get; set; }
|
||||||
public string Slug { get; set; }
|
public string Slug { get; set; }
|
||||||
public string FirstAired { get; set; }
|
public string FirstAired { get; set; }
|
||||||
|
public string LastAired { get; set; }
|
||||||
public int? TvRageId { get; set; }
|
public int? TvRageId { get; set; }
|
||||||
public int? TvMazeId { get; set; }
|
public int? TvMazeId { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -189,6 +189,11 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
series.Year = series.FirstAired.Value.Year;
|
series.Year = series.FirstAired.Value.Year;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (show.LastAired != null)
|
||||||
|
{
|
||||||
|
series.LastAired = DateTime.ParseExact(show.LastAired, "yyyy-MM-dd", DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
|
||||||
|
}
|
||||||
|
|
||||||
series.Overview = show.Overview;
|
series.Overview = show.Overview;
|
||||||
|
|
||||||
if (show.Runtime != null)
|
if (show.Runtime != null)
|
||||||
|
|
|
@ -12,6 +12,7 @@ namespace NzbDrone.Core.SeriesStats
|
||||||
public int SeasonNumber { get; set; }
|
public int SeasonNumber { get; set; }
|
||||||
public string NextAiringString { get; set; }
|
public string NextAiringString { get; set; }
|
||||||
public string PreviousAiringString { get; set; }
|
public string PreviousAiringString { get; set; }
|
||||||
|
public string LastAiredString { get; set; }
|
||||||
public int EpisodeFileCount { get; set; }
|
public int EpisodeFileCount { get; set; }
|
||||||
public int EpisodeCount { get; set; }
|
public int EpisodeCount { get; set; }
|
||||||
public int AvailableEpisodeCount { get; set; }
|
public int AvailableEpisodeCount { get; set; }
|
||||||
|
@ -65,6 +66,29 @@ namespace NzbDrone.Core.SeriesStats
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DateTime? LastAired
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
DateTime lastAired;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!DateTime.TryParse(LastAiredString, out lastAired))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ArgumentOutOfRangeException)
|
||||||
|
{
|
||||||
|
// GHI 3518: Can throw on mono (6.x?) despite being a Try*
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lastAired;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<string> ReleaseGroups
|
public List<string> ReleaseGroups
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ namespace NzbDrone.Core.SeriesStats
|
||||||
public int SeriesId { get; set; }
|
public int SeriesId { get; set; }
|
||||||
public string NextAiringString { get; set; }
|
public string NextAiringString { get; set; }
|
||||||
public string PreviousAiringString { get; set; }
|
public string PreviousAiringString { get; set; }
|
||||||
|
public string LastAiredString { get; set; }
|
||||||
public int EpisodeFileCount { get; set; }
|
public int EpisodeFileCount { get; set; }
|
||||||
public int EpisodeCount { get; set; }
|
public int EpisodeCount { get; set; }
|
||||||
public int TotalEpisodeCount { get; set; }
|
public int TotalEpisodeCount { get; set; }
|
||||||
|
@ -61,5 +62,28 @@ namespace NzbDrone.Core.SeriesStats
|
||||||
return previousAiring;
|
return previousAiring;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DateTime? LastAired
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
DateTime lastAired;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!DateTime.TryParse(LastAiredString, out lastAired))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ArgumentOutOfRangeException)
|
||||||
|
{
|
||||||
|
// GHI 3518: Can throw on mono (6.x?) despite being a Try*
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lastAired;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,8 @@ namespace NzbDrone.Core.SeriesStats
|
||||||
SUM(CASE WHEN (""Monitored"" = {trueIndicator} AND ""AirDateUtc"" <= @currentDate) OR ""EpisodeFileId"" > 0 THEN 1 ELSE 0 END) AS EpisodeCount,
|
SUM(CASE WHEN (""Monitored"" = {trueIndicator} AND ""AirDateUtc"" <= @currentDate) OR ""EpisodeFileId"" > 0 THEN 1 ELSE 0 END) AS EpisodeCount,
|
||||||
SUM(CASE WHEN ""EpisodeFileId"" > 0 THEN 1 ELSE 0 END) AS EpisodeFileCount,
|
SUM(CASE WHEN ""EpisodeFileId"" > 0 THEN 1 ELSE 0 END) AS EpisodeFileCount,
|
||||||
MIN(CASE WHEN ""AirDateUtc"" < @currentDate OR ""Monitored"" = {falseIndicator} THEN NULL ELSE ""AirDateUtc"" END) AS NextAiringString,
|
MIN(CASE WHEN ""AirDateUtc"" < @currentDate OR ""Monitored"" = {falseIndicator} THEN NULL ELSE ""AirDateUtc"" END) AS NextAiringString,
|
||||||
MAX(CASE WHEN ""AirDateUtc"" >= @currentDate OR ""Monitored"" = {falseIndicator} THEN NULL ELSE ""AirDateUtc"" END) AS PreviousAiringString", parameters)
|
MAX(CASE WHEN ""AirDateUtc"" >= @currentDate OR ""Monitored"" = {falseIndicator} THEN NULL ELSE ""AirDateUtc"" END) AS PreviousAiringString,
|
||||||
|
MAX(""AirDate"") AS LastAiredString", parameters)
|
||||||
.GroupBy<Episode>(x => x.SeriesId)
|
.GroupBy<Episode>(x => x.SeriesId)
|
||||||
.GroupBy<Episode>(x => x.SeasonNumber);
|
.GroupBy<Episode>(x => x.SeasonNumber);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace NzbDrone.Core.SeriesStats
|
namespace NzbDrone.Core.SeriesStats
|
||||||
|
@ -52,9 +52,11 @@ namespace NzbDrone.Core.SeriesStats
|
||||||
|
|
||||||
var nextAiring = seasonStatistics.Where(s => s.NextAiring != null).MinBy(s => s.NextAiring);
|
var nextAiring = seasonStatistics.Where(s => s.NextAiring != null).MinBy(s => s.NextAiring);
|
||||||
var previousAiring = seasonStatistics.Where(s => s.PreviousAiring != null).MaxBy(s => s.PreviousAiring);
|
var previousAiring = seasonStatistics.Where(s => s.PreviousAiring != null).MaxBy(s => s.PreviousAiring);
|
||||||
|
var lastAired = seasonStatistics.Where(s => s.SeasonNumber > 0 && s.LastAired != null).MaxBy(s => s.LastAired);
|
||||||
|
|
||||||
seriesStatistics.NextAiringString = nextAiring?.NextAiringString;
|
seriesStatistics.NextAiringString = nextAiring?.NextAiringString;
|
||||||
seriesStatistics.PreviousAiringString = previousAiring?.PreviousAiringString;
|
seriesStatistics.PreviousAiringString = previousAiring?.PreviousAiringString;
|
||||||
|
seriesStatistics.LastAiredString = lastAired?.LastAiredString;
|
||||||
|
|
||||||
return seriesStatistics;
|
return seriesStatistics;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,7 @@ namespace NzbDrone.Core.Tv
|
||||||
series.Images = seriesInfo.Images;
|
series.Images = seriesInfo.Images;
|
||||||
series.Network = seriesInfo.Network;
|
series.Network = seriesInfo.Network;
|
||||||
series.FirstAired = seriesInfo.FirstAired;
|
series.FirstAired = seriesInfo.FirstAired;
|
||||||
|
series.LastAired = seriesInfo.LastAired;
|
||||||
series.Ratings = seriesInfo.Ratings;
|
series.Ratings = seriesInfo.Ratings;
|
||||||
series.Actors = seriesInfo.Actors;
|
series.Actors = seriesInfo.Actors;
|
||||||
series.Genres = seriesInfo.Genres;
|
series.Genres = seriesInfo.Genres;
|
||||||
|
|
|
@ -48,6 +48,7 @@ namespace NzbDrone.Core.Tv
|
||||||
public string RootFolderPath { get; set; }
|
public string RootFolderPath { get; set; }
|
||||||
public DateTime Added { get; set; }
|
public DateTime Added { get; set; }
|
||||||
public DateTime? FirstAired { get; set; }
|
public DateTime? FirstAired { get; set; }
|
||||||
|
public DateTime? LastAired { get; set; }
|
||||||
public LazyLoaded<QualityProfile> QualityProfile { get; set; }
|
public LazyLoaded<QualityProfile> QualityProfile { get; set; }
|
||||||
public Language OriginalLanguage { get; set; }
|
public Language OriginalLanguage { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -245,6 +245,9 @@ namespace Sonarr.Api.V3.Series
|
||||||
|
|
||||||
private void LinkSeriesStatistics(SeriesResource resource, SeriesStatistics seriesStatistics)
|
private void LinkSeriesStatistics(SeriesResource resource, SeriesStatistics seriesStatistics)
|
||||||
{
|
{
|
||||||
|
// Only set last aired from statistics if it's missing from the series itself
|
||||||
|
resource.LastAired ??= seriesStatistics.LastAired;
|
||||||
|
|
||||||
resource.PreviousAiring = seriesStatistics.PreviousAiring;
|
resource.PreviousAiring = seriesStatistics.PreviousAiring;
|
||||||
resource.NextAiring = seriesStatistics.NextAiring;
|
resource.NextAiring = seriesStatistics.NextAiring;
|
||||||
resource.Statistics = seriesStatistics.ToResource(resource.Seasons);
|
resource.Statistics = seriesStatistics.ToResource(resource.Seasons);
|
||||||
|
|
|
@ -51,6 +51,7 @@ namespace Sonarr.Api.V3.Series
|
||||||
public int TvRageId { get; set; }
|
public int TvRageId { get; set; }
|
||||||
public int TvMazeId { get; set; }
|
public int TvMazeId { get; set; }
|
||||||
public DateTime? FirstAired { get; set; }
|
public DateTime? FirstAired { get; set; }
|
||||||
|
public DateTime? LastAired { get; set; }
|
||||||
public SeriesTypes SeriesType { get; set; }
|
public SeriesTypes SeriesType { get; set; }
|
||||||
public string CleanTitle { get; set; }
|
public string CleanTitle { get; set; }
|
||||||
public string ImdbId { get; set; }
|
public string ImdbId { get; set; }
|
||||||
|
@ -121,6 +122,7 @@ namespace Sonarr.Api.V3.Series
|
||||||
TvRageId = model.TvRageId,
|
TvRageId = model.TvRageId,
|
||||||
TvMazeId = model.TvMazeId,
|
TvMazeId = model.TvMazeId,
|
||||||
FirstAired = model.FirstAired,
|
FirstAired = model.FirstAired,
|
||||||
|
LastAired = model.LastAired,
|
||||||
SeriesType = model.SeriesType,
|
SeriesType = model.SeriesType,
|
||||||
CleanTitle = model.CleanTitle,
|
CleanTitle = model.CleanTitle,
|
||||||
ImdbId = model.ImdbId,
|
ImdbId = model.ImdbId,
|
||||||
|
|
Loading…
Reference in New Issue