From 46bd5d1767a262085ce076cf3b0ea2a94c837974 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 22 Oct 2013 17:42:43 -0700 Subject: [PATCH] Fixed: Skip last write time check on linux for _UNPACK_ folders --- .../NotUnpackingSpecificationFixture.cs | 11 +++++++++++ .../Specifications/NotUnpackingSpecification.cs | 7 +++++++ 2 files changed, 18 insertions(+) diff --git a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecificationFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecificationFixture.cs index 05a45a1f6..d05a0931d 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecificationFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecificationFixture.cs @@ -68,5 +68,16 @@ public void should_return_false_if_in_working_folder_and_last_write_time_was_rec Subject.IsSatisfiedBy(_localEpisode).Should().BeFalse(); } + + [Test] + public void should_return_false_if_unopacking_on_linux() + { + LinuxOnly(); + + GivenInWorkingFolder(); + GivenLastWriteTimeUtc(DateTime.UtcNow.AddDays(-5)); + + Subject.IsSatisfiedBy(_localEpisode).Should().BeFalse(); + } } } diff --git a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecification.cs b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecification.cs index b8212e12c..2445e0701 100644 --- a/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecification.cs +++ b/src/NzbDrone.Core/MediaFiles/EpisodeImport/Specifications/NotUnpackingSpecification.cs @@ -2,6 +2,7 @@ using System.IO; using NLog; using NzbDrone.Common; +using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.Configuration; using NzbDrone.Core.Parser.Model; @@ -34,6 +35,12 @@ public bool IsSatisfiedBy(LocalEpisode localEpisode) { if (Directory.GetParent(localEpisode.Path).Name.StartsWith(workingFolder)) { + if (OsInfo.IsLinux) + { + _logger.Trace("{0} is still being unpacked", localEpisode.Path); + return false; + } + if (_diskProvider.GetLastFileWrite(localEpisode.Path) > DateTime.UtcNow.AddMinutes(-5)) { _logger.Trace("{0} appears to be unpacking still", localEpisode.Path);