mirror of
https://github.com/Radarr/Radarr.git
synced 2024-08-18 16:29:41 +02:00
Fixed: Importlist sync setting and validator
This commit is contained in:
parent
1aa117331f
commit
7cd29c48bb
@ -3,18 +3,18 @@
|
|||||||
|
|
||||||
namespace NzbDrone.Api.Config
|
namespace NzbDrone.Api.Config
|
||||||
{
|
{
|
||||||
public class ImportListConfigModule : NzbDroneConfigModule<ImportListConfigResource>
|
public class NetImportConfigModule : NzbDroneConfigModule<NetImportConfigResource>
|
||||||
{
|
{
|
||||||
public ImportListConfigModule(IConfigService configService)
|
public NetImportConfigModule(IConfigService configService)
|
||||||
: base(configService)
|
: base(configService)
|
||||||
{
|
{
|
||||||
SharedValidator.RuleFor(c => c.ImportListSyncInterval)
|
SharedValidator.RuleFor(c => c.ImportListSyncInterval)
|
||||||
.IsValidImportListSyncInterval();
|
.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;
|
using Radarr.Http.REST;
|
||||||
|
|
||||||
namespace NzbDrone.Api.Config
|
namespace NzbDrone.Api.Config
|
||||||
{
|
{
|
||||||
public class ImportListConfigResource : RestResource
|
public class NetImportConfigResource : RestResource
|
||||||
{
|
{
|
||||||
public int ImportListSyncInterval { get; set; }
|
public int ImportListSyncInterval { get; set; }
|
||||||
public string ListSyncLevel { get; set; }
|
public string ListSyncLevel { get; set; }
|
||||||
public string ImportExclusions { 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,
|
ImportListSyncInterval = model.ImportListSyncInterval,
|
||||||
ListSyncLevel = model.ListSyncLevel,
|
ListSyncLevel = model.ListSyncLevel,
|
||||||
|
@ -170,7 +170,7 @@ public void HandleAsync(ConfigSavedEvent message)
|
|||||||
rss.Interval = _configService.RssSyncInterval;
|
rss.Interval = _configService.RssSyncInterval;
|
||||||
|
|
||||||
var importList = _scheduledTaskRepository.GetDefinition(typeof(ImportListSyncCommand));
|
var importList = _scheduledTaskRepository.GetDefinition(typeof(ImportListSyncCommand));
|
||||||
importList.Interval = _configService.ImportListSyncInterval;
|
importList.Interval = GetImportListSyncInterval();
|
||||||
|
|
||||||
var refreshMonitoredDownloads = _scheduledTaskRepository.GetDefinition(typeof(RefreshMonitoredDownloadsCommand));
|
var refreshMonitoredDownloads = _scheduledTaskRepository.GetDefinition(typeof(RefreshMonitoredDownloadsCommand));
|
||||||
refreshMonitoredDownloads.Interval = _configService.CheckForFinishedDownloadInterval;
|
refreshMonitoredDownloads.Interval = _configService.CheckForFinishedDownloadInterval;
|
||||||
|
@ -5,7 +5,7 @@ namespace Radarr.Http.Validation
|
|||||||
public class ImportListSyncIntervalValidator : PropertyValidator
|
public class ImportListSyncIntervalValidator : PropertyValidator
|
||||||
{
|
{
|
||||||
public ImportListSyncIntervalValidator()
|
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;
|
var value = (int)context.PropertyValue;
|
||||||
|
|
||||||
if (value == 0)
|
if (value >= 6)
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value >= 10 && value <= 1440)
|
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user