New: Use TVDB's Episode ID as default uniqueid for Kodi metadata

Closes #4792
This commit is contained in:
Mark McDowall 2022-02-21 21:28:24 -08:00
parent 9e82014454
commit f6b08f697b
6 changed files with 26 additions and 4 deletions

View File

@ -0,0 +1,14 @@
using FluentMigrator;
using NzbDrone.Core.Datastore.Migration.Framework;
namespace NzbDrone.Core.Datastore.Migration
{
[Migration(167)]
public class add_tvdbid_to_episode : NzbDroneMigrationBase
{
protected override void MainDbUpgrade()
{
Alter.Table("Episodes").AddColumn("TvdbId").AsInt32().Nullable();
}
}
}

View File

@ -271,10 +271,14 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc
details.Add(new XElement("displayepisode", episode.AiredBeforeEpisodeNumber ?? -1));
}
var uniqueId = new XElement("uniqueid", episode.Id);
uniqueId.SetAttributeValue("type", "sonarr");
uniqueId.SetAttributeValue("default", true);
details.Add(uniqueId);
var tvdbId = new XElement("uniqueid", episode.TvdbId);
tvdbId.SetAttributeValue("type", "tvdb");
tvdbId.SetAttributeValue("default", true);
details.Add(tvdbId);
var sonarrId = new XElement("uniqueid", episode.Id);
sonarrId.SetAttributeValue("type", "sonarr");
details.Add(sonarrId);
if (image == null)
{

View File

@ -4,6 +4,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
{
public class EpisodeResource
{
public int TvdbId { get; set; }
public int SeasonNumber { get; set; }
public int EpisodeNumber { get; set; }
public int? AbsoluteEpisodeNumber { get; set; }

View File

@ -223,6 +223,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
private static Episode MapEpisode(EpisodeResource oracleEpisode)
{
var episode = new Episode();
episode.TvdbId = oracleEpisode.TvdbId;
episode.Overview = oracleEpisode.Overview;
episode.SeasonNumber = oracleEpisode.SeasonNumber;
episode.EpisodeNumber = oracleEpisode.EpisodeNumber;

View File

@ -17,6 +17,7 @@ namespace NzbDrone.Core.Tv
public const string AIR_DATE_FORMAT = "yyyy-MM-dd";
public int SeriesId { get; set; }
public int TvdbId { get; set; }
public int EpisodeFileId { get; set; }
public int SeasonNumber { get; set; }
public int EpisodeNumber { get; set; }

View File

@ -64,6 +64,7 @@ namespace NzbDrone.Core.Tv
}
episodeToUpdate.SeriesId = series.Id;
episodeToUpdate.TvdbId = episode.TvdbId;
episodeToUpdate.EpisodeNumber = episode.EpisodeNumber;
episodeToUpdate.SeasonNumber = episode.SeasonNumber;
episodeToUpdate.AbsoluteEpisodeNumber = episode.AbsoluteEpisodeNumber;