mirror of
https://github.com/Radarr/Radarr
synced 2025-02-22 06:11:09 +00:00
Fixed: Importlist sync setting and validator
This commit is contained in:
parent
1aa117331f
commit
7cd29c48bb
6 changed files with 12 additions and 17 deletions
|
@ -3,18 +3,18 @@
|
|||
|
||||
namespace NzbDrone.Api.Config
|
||||
{
|
||||
public class ImportListConfigModule : NzbDroneConfigModule<ImportListConfigResource>
|
||||
public class NetImportConfigModule : NzbDroneConfigModule<NetImportConfigResource>
|
||||
{
|
||||
public ImportListConfigModule(IConfigService configService)
|
||||
public NetImportConfigModule(IConfigService configService)
|
||||
: base(configService)
|
||||
{
|
||||
SharedValidator.RuleFor(c => c.ImportListSyncInterval)
|
||||
.IsValidImportListSyncInterval();
|
||||
}
|
||||
|
||||
protected override ImportListConfigResource ToResource(IConfigService model)
|
||||
protected override NetImportConfigResource ToResource(IConfigService model)
|
||||
{
|
||||
return ImportListConfigResourceMapper.ToResource(model);
|
||||
return NetImportConfigResourceMapper.ToResource(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using Radarr.Http.REST;
|
||||
|
||||
namespace NzbDrone.Api.Config
|
||||
{
|
||||
public class ImportListConfigResource : RestResource
|
||||
public class NetImportConfigResource : RestResource
|
||||
{
|
||||
public int ImportListSyncInterval { get; set; }
|
||||
public string ListSyncLevel { get; set; }
|
||||
public string ImportExclusions { get; set; }
|
||||
}
|
||||
|
||||
public static class ImportListConfigResourceMapper
|
||||
public static class NetImportConfigResourceMapper
|
||||
{
|
||||
public static ImportListConfigResource ToResource(IConfigService model)
|
||||
public static NetImportConfigResource ToResource(IConfigService model)
|
||||
{
|
||||
return new ImportListConfigResource
|
||||
return new NetImportConfigResource
|
||||
{
|
||||
ImportListSyncInterval = model.ImportListSyncInterval,
|
||||
ListSyncLevel = model.ListSyncLevel,
|
||||
|
|
|
@ -170,7 +170,7 @@ public void HandleAsync(ConfigSavedEvent message)
|
|||
rss.Interval = _configService.RssSyncInterval;
|
||||
|
||||
var importList = _scheduledTaskRepository.GetDefinition(typeof(ImportListSyncCommand));
|
||||
importList.Interval = _configService.ImportListSyncInterval;
|
||||
importList.Interval = GetImportListSyncInterval();
|
||||
|
||||
var refreshMonitoredDownloads = _scheduledTaskRepository.GetDefinition(typeof(RefreshMonitoredDownloadsCommand));
|
||||
refreshMonitoredDownloads.Interval = _configService.CheckForFinishedDownloadInterval;
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Radarr.Http.Validation
|
|||
public class ImportListSyncIntervalValidator : PropertyValidator
|
||||
{
|
||||
public ImportListSyncIntervalValidator()
|
||||
: base("Must be between 10 and 1440 or 0 to disable")
|
||||
: base("Must be greater than 6 hours")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,7 @@ protected override bool IsValid(PropertyValidatorContext context)
|
|||
|
||||
var value = (int)context.PropertyValue;
|
||||
|
||||
if (value == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (value >= 10 && value <= 1440)
|
||||
if (value >= 6)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue