From 9f403b46ffac7ef040c096d6175d866d0335ce41 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 9 Oct 2013 17:23:13 -0700 Subject: [PATCH] Dropped TVDbEpisodeId since its not used and was causing contraint issues Fixed: Issues refreshing some series due to episodes being reordered on TheTVDB --- .../MetadataSourceTests/TraktProxyFixture.cs | 3 --- .../EpisodesWithoutFilesFixture.cs | 2 -- .../TvTests/RefreshEpisodeServiceFixture.cs | Bin 7755 -> 6639 bytes .../Migration/024_drop_tvdb_episodeid.cs | 14 ++++++++++++++ .../MetadataSource/TraktProxy.cs | 1 - src/NzbDrone.Core/NzbDrone.Core.csproj | 1 + src/NzbDrone.Core/Tv/Episode.cs | 3 +-- src/NzbDrone.Core/Tv/RefreshEpisodeService.cs | 1 - src/UI/System/Logs/Files/LogFileLayout.js | 3 +-- 9 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 src/NzbDrone.Core/Datastore/Migration/024_drop_tvdb_episodeid.cs diff --git a/src/NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs b/src/NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs index b1df6db29..4577fe5c9 100644 --- a/src/NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs +++ b/src/NzbDrone.Core.Test/MetadataSourceTests/TraktProxyFixture.cs @@ -80,8 +80,6 @@ namespace NzbDrone.Core.Test.MetadataSourceTests episodes.GroupBy(e => e.SeasonNumber.ToString("000") + e.EpisodeNumber.ToString("000")) .Max(e => e.Count()).Should().Be(1); - episodes.Select(c => c.TvDbEpisodeId).Should().OnlyHaveUniqueItems(); - episodes.Should().Contain(c => c.SeasonNumber > 0); episodes.Should().Contain(c => !string.IsNullOrWhiteSpace(c.Overview)); @@ -98,7 +96,6 @@ namespace NzbDrone.Core.Test.MetadataSourceTests { episode.Should().NotBeNull(); episode.EpisodeNumber.Should().NotBe(0); - episode.TvDbEpisodeId.Should().BeGreaterThan(0); episode.Should().NotBeNull(); diff --git a/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs index e08d77b23..e59c67dec 100644 --- a/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs +++ b/src/NzbDrone.Core.Test/TvTests/EpisodeRepositoryTests/EpisodesWithoutFilesFixture.cs @@ -48,7 +48,6 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests var monitoredSeriesEpisodes = Builder.CreateListOfSize(3) .All() .With(e => e.Id = 0) - .With(e => e.TvDbEpisodeId = RandomNumber) .With(e => e.SeriesId = _monitoredSeries.Id) .With(e => e.EpisodeFileId = 0) .With(e => e.AirDateUtc = DateTime.Now.AddDays(-5)) @@ -62,7 +61,6 @@ namespace NzbDrone.Core.Test.TvTests.EpisodeRepositoryTests var unmonitoredSeriesEpisodes = Builder.CreateListOfSize(3) .All() .With(e => e.Id = 0) - .With(e => e.TvDbEpisodeId = RandomNumber) .With(e => e.SeriesId = _unmonitoredSeries.Id) .With(e => e.EpisodeFileId = 0) .With(e => e.AirDateUtc = DateTime.Now.AddDays(-5)) diff --git a/src/NzbDrone.Core.Test/TvTests/RefreshEpisodeServiceFixture.cs b/src/NzbDrone.Core.Test/TvTests/RefreshEpisodeServiceFixture.cs index b02608d8d5604848368d71d94e6f0a4dc2251bad..bb89e1a8c84413861c36b49400df8a10c3f511e3 100644 GIT binary patch delta 12 TcmX?Y^WJy^v%uzfkvE(GBvJ(k delta 481 zcmaEFeA;FMv%utjPImc{vXrFw)Pl_7{FK!A%#`@@jMTjN%#!%zjKsY3)Z)n-S)?cb z7hqMc$Sf|&%u9ELs8q03a4OBrNl7iTfr{Aia!qy=QRh+6b1q6vEJ^iCE!UXLD55<% zLxfi_q|7A=s?IY7sMmCoh|c8yA{-{xyj;9o3P_+Vu}C2=wVZ%8D%_~HsDo?~Lbt`z z66gSRkUi-b_N1cvM=v-dzceSsBe5)1LsQQ&CnumNzaX`!Br~ z0!=;F!qUW?kbDh}cthZV?g3O>M~ga;c?B|<+?(L}Cz f3+Md2lElnBtkx>n+9GK{b<$)-&b-ac0&h40dET9- diff --git a/src/NzbDrone.Core/Datastore/Migration/024_drop_tvdb_episodeid.cs b/src/NzbDrone.Core/Datastore/Migration/024_drop_tvdb_episodeid.cs new file mode 100644 index 000000000..90144bcbb --- /dev/null +++ b/src/NzbDrone.Core/Datastore/Migration/024_drop_tvdb_episodeid.cs @@ -0,0 +1,14 @@ +using FluentMigrator; +using NzbDrone.Core.Datastore.Migration.Framework; + +namespace NzbDrone.Core.Datastore.Migration +{ + [Migration(24)] + public class drop_tvdb_episodeid : NzbDroneMigrationBase + { + protected override void MainDbUpgrade() + { + SqLiteAlter.DropColumns("Episodes", new[] { "TvDbEpisodeId" }); + } + } +} diff --git a/src/NzbDrone.Core/MetadataSource/TraktProxy.cs b/src/NzbDrone.Core/MetadataSource/TraktProxy.cs index b907a0a16..441f6ee21 100644 --- a/src/NzbDrone.Core/MetadataSource/TraktProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/TraktProxy.cs @@ -98,7 +98,6 @@ namespace NzbDrone.Core.MetadataSource episode.SeasonNumber = traktEpisode.season; episode.EpisodeNumber = traktEpisode.episode; episode.EpisodeNumber = traktEpisode.number; - episode.TvDbEpisodeId = traktEpisode.tvdb_id; episode.Title = traktEpisode.title; episode.AirDate = FromIsoToString(traktEpisode.first_aired_iso); episode.AirDateUtc = FromIso(traktEpisode.first_aired_iso); diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index 7afcb1bb1..6c0c4bb3e 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -175,6 +175,7 @@ + diff --git a/src/NzbDrone.Core/Tv/Episode.cs b/src/NzbDrone.Core/Tv/Episode.cs index 51775a754..854dceb9c 100644 --- a/src/NzbDrone.Core/Tv/Episode.cs +++ b/src/NzbDrone.Core/Tv/Episode.cs @@ -11,7 +11,6 @@ namespace NzbDrone.Core.Tv { public const string AIR_DATE_FORMAT = "yyyy-MM-dd"; - public int TvDbEpisodeId { get; set; } public int SeriesId { get; set; } public int EpisodeFileId { get; set; } public int SeasonNumber { get; set; } @@ -39,7 +38,7 @@ namespace NzbDrone.Core.Tv public override string ToString() { - return string.Format("[{0}]{1}", TvDbEpisodeId, Title.NullSafe()); + return string.Format("[{0}]{1}", Id, Title.NullSafe()); } } } \ No newline at end of file diff --git a/src/NzbDrone.Core/Tv/RefreshEpisodeService.cs b/src/NzbDrone.Core/Tv/RefreshEpisodeService.cs index 1d1ca0a5b..f8436dc24 100644 --- a/src/NzbDrone.Core/Tv/RefreshEpisodeService.cs +++ b/src/NzbDrone.Core/Tv/RefreshEpisodeService.cs @@ -58,7 +58,6 @@ namespace NzbDrone.Core.Tv } episodeToUpdate.SeriesId = series.Id; - episodeToUpdate.TvDbEpisodeId = episode.TvDbEpisodeId; episodeToUpdate.EpisodeNumber = episode.EpisodeNumber; episodeToUpdate.SeasonNumber = episode.SeasonNumber; episodeToUpdate.Title = episode.Title; diff --git a/src/UI/System/Logs/Files/LogFileLayout.js b/src/UI/System/Logs/Files/LogFileLayout.js index e1ab9d69b..e4c272dfe 100644 --- a/src/UI/System/Logs/Files/LogFileLayout.js +++ b/src/UI/System/Logs/Files/LogFileLayout.js @@ -57,12 +57,11 @@ define( initialize: function () { this.collection = new LogFileCollection(); - vent.on(vent.Commands.ShowLogFile, this._fetchLogFileContents, this); + vent.on(vent.Commands.ShowLogFile, this._fetchLogFileContents, this); vent.on(vent.Events.CommandComplete, this._commandComplete, this); this.listenTo(this.collection, 'sync', this._collectionSynced); this.collection.fetch(); - }, onShow: function () {