parent
b2267a55ce
commit
7829b18b3c
|
@ -165,6 +165,23 @@ class MediaManagement extends Component {
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<FormGroup
|
||||||
|
advancedSettings={advancedSettings}
|
||||||
|
isAdvanced={true}
|
||||||
|
size={sizes.MEDIUM}
|
||||||
|
>
|
||||||
|
<FormLabel>Minimum Free Space</FormLabel>
|
||||||
|
|
||||||
|
<FormInputGroup
|
||||||
|
type={inputTypes.NUMBER}
|
||||||
|
unit='MB'
|
||||||
|
name="minimumFreeSpaceWhenImporting"
|
||||||
|
helpText="Prevent import if it would leave less than this amount of disk space available"
|
||||||
|
onChange={onInputChange}
|
||||||
|
{...settings.minimumFreeSpaceWhenImporting}
|
||||||
|
/>
|
||||||
|
</FormGroup>
|
||||||
|
|
||||||
<FormGroup
|
<FormGroup
|
||||||
advancedSettings={advancedSettings}
|
advancedSettings={advancedSettings}
|
||||||
isAdvanced={true}
|
isAdvanced={true}
|
||||||
|
|
|
@ -68,8 +68,11 @@ namespace NzbDrone.Core.Test.MediaFiles.EpisodeImport.Specifications
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void should_reject_when_there_isnt_enough_space_for_file_plus_100mb_padding()
|
public void should_reject_when_there_isnt_enough_space_for_file_plus_min_free_space()
|
||||||
{
|
{
|
||||||
|
Mocker.GetMock<IConfigService>()
|
||||||
|
.Setup(s => s.MinimumFreeSpaceWhenImporting)
|
||||||
|
.Returns(100);
|
||||||
GivenFileSize(100.Megabytes());
|
GivenFileSize(100.Megabytes());
|
||||||
GivenFreeSpace(150.Megabytes());
|
GivenFreeSpace(150.Megabytes());
|
||||||
|
|
||||||
|
|
|
@ -196,6 +196,13 @@ namespace NzbDrone.Core.Configuration
|
||||||
set { SetValue("SkipFreeSpaceCheckWhenImporting", value); }
|
set { SetValue("SkipFreeSpaceCheckWhenImporting", value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int MinimumFreeSpaceWhenImporting
|
||||||
|
{
|
||||||
|
get { return GetValueInt("MinimumFreeSpaceWhenImporting", 100); }
|
||||||
|
|
||||||
|
set { SetValue("MinimumFreeSpaceWhenImporting", value); }
|
||||||
|
}
|
||||||
|
|
||||||
public bool CopyUsingHardlinks
|
public bool CopyUsingHardlinks
|
||||||
{
|
{
|
||||||
get { return GetValueBoolean("CopyUsingHardlinks", true); }
|
get { return GetValueBoolean("CopyUsingHardlinks", true); }
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace NzbDrone.Core.Configuration
|
||||||
bool DeleteEmptyFolders { get; set; }
|
bool DeleteEmptyFolders { get; set; }
|
||||||
FileDateType FileDate { get; set; }
|
FileDateType FileDate { get; set; }
|
||||||
bool SkipFreeSpaceCheckWhenImporting { get; set; }
|
bool SkipFreeSpaceCheckWhenImporting { get; set; }
|
||||||
|
int MinimumFreeSpaceWhenImporting { get; set; }
|
||||||
bool CopyUsingHardlinks { get; set; }
|
bool CopyUsingHardlinks { get; set; }
|
||||||
bool EnableMediaInfo { get; set; }
|
bool EnableMediaInfo { get; set; }
|
||||||
bool ImportExtraFiles { get; set; }
|
bool ImportExtraFiles { get; set; }
|
||||||
|
|
|
@ -47,7 +47,7 @@ namespace NzbDrone.Core.MediaFiles.EpisodeImport.Specifications
|
||||||
return Decision.Accept();
|
return Decision.Accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freeSpace < localEpisode.Size + 100.Megabytes())
|
if (freeSpace < localEpisode.Size + _configService.MinimumFreeSpaceWhenImporting.Megabytes())
|
||||||
{
|
{
|
||||||
_logger.Warn("Not enough free space ({0}) to import: {1} ({2})", freeSpace, localEpisode, localEpisode.Size);
|
_logger.Warn("Not enough free space ({0}) to import: {1} ({2})", freeSpace, localEpisode, localEpisode.Size);
|
||||||
return Decision.Reject("Not enough free space");
|
return Decision.Reject("Not enough free space");
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace Sonarr.Api.V3.Config
|
||||||
SharedValidator.RuleFor(c => c.FileChmod).NotEmpty();
|
SharedValidator.RuleFor(c => c.FileChmod).NotEmpty();
|
||||||
SharedValidator.RuleFor(c => c.FolderChmod).NotEmpty();
|
SharedValidator.RuleFor(c => c.FolderChmod).NotEmpty();
|
||||||
SharedValidator.RuleFor(c => c.RecycleBin).IsValidPath().SetValidator(pathExistsValidator).When(c => !string.IsNullOrWhiteSpace(c.RecycleBin));
|
SharedValidator.RuleFor(c => c.RecycleBin).IsValidPath().SetValidator(pathExistsValidator).When(c => !string.IsNullOrWhiteSpace(c.RecycleBin));
|
||||||
|
SharedValidator.RuleFor(c => c.MinimumFreeSpaceWhenImporting).GreaterThanOrEqualTo(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override MediaManagementConfigResource ToResource(IConfigService model)
|
protected override MediaManagementConfigResource ToResource(IConfigService model)
|
||||||
|
|
|
@ -25,6 +25,7 @@ namespace Sonarr.Api.V3.Config
|
||||||
|
|
||||||
public EpisodeTitleRequiredType EpisodeTitleRequired { get; set; }
|
public EpisodeTitleRequiredType EpisodeTitleRequired { get; set; }
|
||||||
public bool SkipFreeSpaceCheckWhenImporting { get; set; }
|
public bool SkipFreeSpaceCheckWhenImporting { get; set; }
|
||||||
|
public int MinimumFreeSpaceWhenImporting { get; set; }
|
||||||
public bool CopyUsingHardlinks { get; set; }
|
public bool CopyUsingHardlinks { get; set; }
|
||||||
public bool ImportExtraFiles { get; set; }
|
public bool ImportExtraFiles { get; set; }
|
||||||
public string ExtraFileExtensions { get; set; }
|
public string ExtraFileExtensions { get; set; }
|
||||||
|
@ -54,6 +55,7 @@ namespace Sonarr.Api.V3.Config
|
||||||
|
|
||||||
EpisodeTitleRequired = model.EpisodeTitleRequired,
|
EpisodeTitleRequired = model.EpisodeTitleRequired,
|
||||||
SkipFreeSpaceCheckWhenImporting = model.SkipFreeSpaceCheckWhenImporting,
|
SkipFreeSpaceCheckWhenImporting = model.SkipFreeSpaceCheckWhenImporting,
|
||||||
|
MinimumFreeSpaceWhenImporting = model.MinimumFreeSpaceWhenImporting,
|
||||||
CopyUsingHardlinks = model.CopyUsingHardlinks,
|
CopyUsingHardlinks = model.CopyUsingHardlinks,
|
||||||
ImportExtraFiles = model.ImportExtraFiles,
|
ImportExtraFiles = model.ImportExtraFiles,
|
||||||
ExtraFileExtensions = model.ExtraFileExtensions,
|
ExtraFileExtensions = model.ExtraFileExtensions,
|
||||||
|
|
Loading…
Reference in New Issue