1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

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

This commit is contained in:
Mark McDowall 2014-04-04 09:25:18 -07:00
parent 52c5c19b0a
commit 0f9360bccb
5 changed files with 56 additions and 2 deletions

View File

@ -7,6 +7,7 @@
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 @@ public void should_return_true_if_free_space_is_null()
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();
}
}
}

View File

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

View File

@ -26,6 +26,7 @@ public interface IConfigService
Boolean AutoDownloadPropers { get; set; }
Boolean CreateEmptySeriesFolders { get; set; }
FileDateType FileDate { get; set; }
Boolean SkipFreeSpaceCheckWhenImporting { get; set; }
//Permissions (Media Management)
Boolean SetPermissionsLinux { get; set; }

View File

@ -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 @@ public FreeSpaceSpecification(IDiskProvider diskProvider, Logger logger)
public bool IsSatisfiedBy(LocalEpisode localEpisode)
{
if (_configService.SkipFreeSpaceCheckWhenImporting)
{
_logger.Debug("Skipping free space check when importing");
return true;
}
try
{
if (localEpisode.ExistingFile)

View File

@ -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}}