mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
Removed premove and instead check for source file being in use
This commit is contained in:
parent
a6e356c0cf
commit
a5e8452840
11 changed files with 178 additions and 48 deletions
|
@ -0,0 +1,40 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
using NzbDrone.Core.Tv;
|
||||
|
||||
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
||||
{
|
||||
public class NotInUseSpecification : IImportDecisionEngineSpecification
|
||||
{
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly Logger _logger;
|
||||
|
||||
public NotInUseSpecification(IDiskProvider diskProvider, Logger logger)
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public string RejectionReason { get { return "File is in use"; } }
|
||||
|
||||
public bool IsSatisfiedBy(LocalEpisode localEpisode)
|
||||
{
|
||||
if (_diskProvider.IsParent(localEpisode.Series.Path, localEpisode.Path))
|
||||
{
|
||||
_logger.Trace("{0} is in series folder, skipping in use check", localEpisode.Path);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_diskProvider.IsFileLocked(new FileInfo(localEpisode.Path)))
|
||||
{
|
||||
_logger.Trace("{0} is in use");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue