From b183743d9f0a0b15e4a9db0a9d3d2d1c238b0d9c Mon Sep 17 00:00:00 2001 From: Bogdan Date: Sun, 29 Oct 2023 00:45:47 +0300 Subject: [PATCH] Fixed: Avoid import loop for already imported episodes part of season packs Closes #6075 --- .../Specifications/AlreadyImportedSpecificationFixture.cs | 2 +- .../Specifications/AlreadyImportedSpecification.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/AlreadyImportedSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/AlreadyImportedSpecificationFixture.cs index 9e276d909..3898118ef 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/AlreadyImportedSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/AlreadyImportedSpecificationFixture.cs @@ -123,7 +123,7 @@ public void should_reject_if_episode_imported_after_being_grabbed() GivenHistory(history); - Subject.IsSatisfiedBy(_localEpisode, _downloadClientItem).Accepted.Should().BeTrue(); + Subject.IsSatisfiedBy(_localEpisode, _downloadClientItem).Accepted.Should().BeFalse(); } } } diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/AlreadyImportedSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/AlreadyImportedSpecification.cs index 891cef89a..e7a62650b 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/AlreadyImportedSpecification.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/AlreadyImportedSpecification.cs @@ -67,6 +67,11 @@ public Decision IsSatisfiedBy(LocalEpisode localEpisode, DownloadClientItem down return Decision.Reject("Episode file already imported at {0}", lastImported.Date.ToLocalTime()); } } + else + { + _logger.Debug("Episode file previously imported at {0}", lastImported.Date); + return Decision.Reject("Episode file already imported at {0}", lastImported.Date.ToLocalTime()); + } } return Decision.Accept();