New: Advanced option to skip checking free space when importing files

pull/4/head
Mark McDowall 11 years ago
parent 52c5c19b0a
commit 0f9360bccb

@ -7,6 +7,7 @@ using Moq;
using NUnit.Framework;
using NzbDrone.Common;
using NzbDrone.Common.Disk;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.MediaFiles.EpisodeImport.Specifications;
using NzbDrone.Core.Parser.Model;
using NzbDrone.Core.Test.Framework;
@ -143,5 +144,15 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
Subject.IsSatisfiedBy(_localEpisode).Should().BeTrue();
}
[Test]
public void should_return_true_when_skip_check_is_enabled()
{
Mocker.GetMock<IConfigService>()
.Setup(s => s.SkipFreeSpaceCheckWhenImporting)
.Returns(true);
Subject.IsSatisfiedBy(_localEpisode).Should().BeTrue();
}
}
}

@ -164,6 +164,13 @@ namespace NzbDrone.Core.Configuration
set { SetValue("DownloadedEpisodesScanInterval", value); }
}
public Boolean SkipFreeSpaceCheckWhenImporting
{
get { return GetValueBoolean("SkipFreeSpaceCheckWhenImporting", false); }
set { SetValue("SkipFreeSpaceCheckWhenImporting", value); }
}
public Boolean SetPermissionsLinux
{
get { return GetValueBoolean("SetPermissionsLinux", false); }

@ -26,6 +26,7 @@ namespace NzbDrone.Core.Configuration
Boolean AutoDownloadPropers { get; set; }
Boolean CreateEmptySeriesFolders { get; set; }
FileDateType FileDate { get; set; }
Boolean SkipFreeSpaceCheckWhenImporting { get; set; }
//Permissions (Media Management)
Boolean SetPermissionsLinux { get; set; }

@ -1,8 +1,8 @@
using System;
using System.IO;
using NLog;
using NzbDrone.Common;
using NzbDrone.Common.Disk;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
@ -10,11 +10,13 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
public class FreeSpaceSpecification : IImportDecisionEngineSpecification
{
private readonly IDiskProvider _diskProvider;
private readonly IConfigService _configService;
private readonly Logger _logger;
public FreeSpaceSpecification(IDiskProvider diskProvider, Logger logger)
public FreeSpaceSpecification(IDiskProvider diskProvider, IConfigService configService, Logger logger)
{
_diskProvider = diskProvider;
_configService = configService;
_logger = logger;
}
@ -22,6 +24,12 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
public bool IsSatisfiedBy(LocalEpisode localEpisode)
{
if (_configService.SkipFreeSpaceCheckWhenImporting)
{
_logger.Debug("Skipping free space check when importing");
return true;
}
try
{
if (localEpisode.ExistingFile)

@ -22,3 +22,30 @@
</div>
</div>
</fieldset>
{{#isMono}}
<fieldset class="advanced-setting">
<legend>Importing</legend>
<div class="control-group">
<label class="control-label">Skip Free Space Check</label>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="skipFreeSpaceCheckWhenImporting"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"/>
</label>
<span class="help-inline-checkbox">
<i class="icon-nd-form-info" title="Use when drone is unable to detect free space from your series root folder"/>
</span>
</div>
</div>
</fieldset>
{{/isMono}}

Loading…
Cancel
Save