New: Added aired-before field to kodi metadata to sort specials

closes #3073
This commit is contained in:
netpok 2019-04-19 21:19:39 +02:00 committed by Taloth Saldono
parent cde5a6d1a4
commit c5257de436
6 changed files with 38 additions and 4 deletions

View File

@ -0,0 +1,16 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(137)]
public class add_airedbefore_to_episodes : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("Episodes").AddColumn("AiredAfterSeasonNumber").AsInt32().Nullable()
.AddColumn("AiredBeforeSeasonNumber").AsInt32().Nullable()
.AddColumn("AiredBeforeEpisodeNumber").AsInt32().Nullable();
}
}
}

View File

@ -255,9 +255,15 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
details.Add(new XElement("aired", episode.AirDate)); details.Add(new XElement("aired", episode.AirDate));
details.Add(new XElement("plot", episode.Overview)); details.Add(new XElement("plot", episode.Overview));
//If trakt ever gets airs before information for specials we should add set it if (episode.SeasonNumber == 0 && episode.AiredAfterSeasonNumber.HasValue)
details.Add(new XElement("displayseason")); {
details.Add(new XElement("displayepisode")); details.Add(new XElement("displayafterseason", episode.AiredAfterSeasonNumber));
}
else if (episode.SeasonNumber == 0 && episode.AiredBeforeSeasonNumber.HasValue)
{
details.Add(new XElement("displayseason", episode.AiredBeforeSeasonNumber));
details.Add(new XElement("displayepisode", episode.AiredBeforeEpisodeNumber ?? -1));
}
var uniqueId = new XElement("uniqueid", episode.Id); var uniqueId = new XElement("uniqueid", episode.Id);
uniqueId.SetAttributeValue("type", "sonarr"); uniqueId.SetAttributeValue("type", "sonarr");

View File

@ -7,6 +7,9 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
public int SeasonNumber { get; set; } public int SeasonNumber { get; set; }
public int EpisodeNumber { get; set; } public int EpisodeNumber { get; set; }
public int? AbsoluteEpisodeNumber { get; set; } public int? AbsoluteEpisodeNumber { get; set; }
public int? AiredAfterSeasonNumber { get; set; }
public int? AiredBeforeSeasonNumber { get; set; }
public int? AiredBeforeEpisodeNumber { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string AirDate { get; set; } public string AirDate { get; set; }
public DateTime? AirDateUtc { get; set; } public DateTime? AirDateUtc { get; set; }

View File

@ -222,6 +222,9 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
episode.EpisodeNumber = oracleEpisode.EpisodeNumber; episode.EpisodeNumber = oracleEpisode.EpisodeNumber;
episode.AbsoluteEpisodeNumber = oracleEpisode.AbsoluteEpisodeNumber; episode.AbsoluteEpisodeNumber = oracleEpisode.AbsoluteEpisodeNumber;
episode.Title = oracleEpisode.Title; episode.Title = oracleEpisode.Title;
episode.AiredAfterSeasonNumber = oracleEpisode.AiredAfterSeasonNumber;
episode.AiredBeforeSeasonNumber = oracleEpisode.AiredBeforeSeasonNumber;
episode.AiredBeforeEpisodeNumber = oracleEpisode.AiredBeforeEpisodeNumber;
episode.AirDate = oracleEpisode.AirDate; episode.AirDate = oracleEpisode.AirDate;
episode.AirDateUtc = oracleEpisode.AirDateUtc; episode.AirDateUtc = oracleEpisode.AirDateUtc;

View File

@ -29,6 +29,9 @@ namespace NzbDrone.Core.Tv
public int? SceneAbsoluteEpisodeNumber { get; set; } public int? SceneAbsoluteEpisodeNumber { get; set; }
public int? SceneSeasonNumber { get; set; } public int? SceneSeasonNumber { get; set; }
public int? SceneEpisodeNumber { get; set; } public int? SceneEpisodeNumber { get; set; }
public int? AiredAfterSeasonNumber { get; set; }
public int? AiredBeforeSeasonNumber { get; set; }
public int? AiredBeforeEpisodeNumber { get; set; }
public bool UnverifiedSceneNumbering { get; set; } public bool UnverifiedSceneNumbering { get; set; }
public Ratings Ratings { get; set; } public Ratings Ratings { get; set; }
public List<MediaCover.MediaCover> Images { get; set; } public List<MediaCover.MediaCover> Images { get; set; }

View File

@ -66,6 +66,9 @@ namespace NzbDrone.Core.Tv
episodeToUpdate.EpisodeNumber = episode.EpisodeNumber; episodeToUpdate.EpisodeNumber = episode.EpisodeNumber;
episodeToUpdate.SeasonNumber = episode.SeasonNumber; episodeToUpdate.SeasonNumber = episode.SeasonNumber;
episodeToUpdate.AbsoluteEpisodeNumber = episode.AbsoluteEpisodeNumber; episodeToUpdate.AbsoluteEpisodeNumber = episode.AbsoluteEpisodeNumber;
episodeToUpdate.AiredAfterSeasonNumber = episode.AiredAfterSeasonNumber;
episodeToUpdate.AiredBeforeSeasonNumber = episode.AiredBeforeSeasonNumber;
episodeToUpdate.AiredBeforeEpisodeNumber = episode.AiredBeforeEpisodeNumber;
episodeToUpdate.Title = episode.Title ?? "TBA"; episodeToUpdate.Title = episode.Title ?? "TBA";
episodeToUpdate.Overview = episode.Overview; episodeToUpdate.Overview = episode.Overview;
episodeToUpdate.AirDate = episode.AirDate; episodeToUpdate.AirDate = episode.AirDate;