Cleanup Config Options

Fixes #610
pull/633/head
Qstick 3 years ago
parent 25bb5b6427
commit 5979c5f8fe

@ -4,7 +4,5 @@ export const CLEAR_HISTORY = 'ClearHistory';
export const CLEAR_LOGS = 'ClearLog';
export const DELETE_LOG_FILES = 'DeleteLogFiles';
export const DELETE_UPDATE_LOG_FILES = 'DeleteUpdateLogFiles';
export const INTERACTIVE_IMPORT = 'ManualImport';
export const RESET_API_KEY = 'ResetApiKey';
export const RSS_SYNC = 'RssSync';
export const APP_INDEXER_SYNC = 'ApplicationIndexerSync';

@ -13,20 +13,8 @@ function getIconName(name) {
return icons.BACKUP;
case 'CheckHealth':
return icons.HEALTH;
case 'EpisodeSearch':
return icons.SEARCH;
case 'Housekeeping':
return icons.HOUSEKEEPING;
case 'RefreshMovie':
return icons.REFRESH;
case 'RssSync':
return icons.RSS;
case 'SeasonSearch':
return icons.SEARCH;
case 'MovieSearch':
return icons.SEARCH;
case 'UpdateSceneMapping':
return icons.REFRESH;
default:
return icons.SPINNER;
}

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using FluentAssertions;
@ -20,10 +20,10 @@ namespace NzbDrone.Core.Test.Configuration
[Test]
public void Add_new_value_to_database()
{
const string key = "RssSyncInterval";
const int value = 12;
const string key = "HistoryCleanupDays";
const int value = 20;
Subject.RssSyncInterval = value;
Subject.HistoryCleanupDays = value;
AssertUpsert(key, value);
}
@ -31,7 +31,7 @@ namespace NzbDrone.Core.Test.Configuration
[Test]
public void Get_value_should_return_default_when_no_value()
{
Subject.RssSyncInterval.Should().Be(60);
Subject.HistoryCleanupDays.Should().Be(365);
}
[Test]
@ -45,8 +45,8 @@ namespace NzbDrone.Core.Test.Configuration
[Test]
public void get_value_with_out_persist_should_not_store_default_value()
{
var interval = Subject.RssSyncInterval;
interval.Should().Be(60);
var interval = Subject.HistoryCleanupDays;
interval.Should().Be(365);
Mocker.GetMock<IConfigRepository>().Verify(c => c.Insert(It.IsAny<Config>()), Times.Never());
}

@ -77,77 +77,12 @@ namespace NzbDrone.Core.Configuration
return _repository.Get(key.ToLower()) != null;
}
public int Retention
{
get { return GetValueInt("Retention", 0); }
set { SetValue("Retention", value); }
}
public int HistoryCleanupDays
{
get { return GetValueInt("HistoryCleanupDays", 365); }
set { SetValue("HistoryCleanupDays", value); }
}
public int RssSyncInterval
{
get { return GetValueInt("RssSyncInterval", 60); }
set { SetValue("RssSyncInterval", value); }
}
public int AvailabilityDelay
{
get { return GetValueInt("AvailabilityDelay", 0); }
set { SetValue("AvailabilityDelay", value); }
}
public int ImportListSyncInterval
{
get { return GetValueInt("ImportListSyncInterval", 240); }
set { SetValue("ImportListSyncInterval", value); }
}
public string ListSyncLevel
{
get { return GetValue("ListSyncLevel", "disabled"); }
set { SetValue("ListSyncLevel", value); }
}
public string ImportExclusions
{
get { return GetValue("ImportExclusions", string.Empty); }
set { SetValue("ImportExclusions", value); }
}
public int MaximumSize
{
get { return GetValueInt("MaximumSize", 0); }
set { SetValue("MaximumSize", value); }
}
public int MinimumAge
{
get { return GetValueInt("MinimumAge", 0); }
set { SetValue("MinimumAge", value); }
}
public bool EnableCompletedDownloadHandling
{
get { return GetValueBoolean("EnableCompletedDownloadHandling", true); }
set { SetValue("EnableCompletedDownloadHandling", value); }
}
public bool PreferIndexerFlags
{
get { return GetValueBoolean("PreferIndexerFlags", false); }
set { SetValue("PreferIndexerFlags", value); }
}
public bool LogIndexerResponse
{
get { return GetValueBoolean("LogIndexerResponse", false); }
@ -155,61 +90,12 @@ namespace NzbDrone.Core.Configuration
set { SetValue("LogIndexerResponse", value); }
}
public bool AllowHardcodedSubs
{
get { return GetValueBoolean("AllowHardcodedSubs", false); }
set { SetValue("AllowHardcodedSubs", value); }
}
public string WhitelistedHardcodedSubs
{
get { return GetValue("WhitelistedHardcodedSubs", ""); }
set { SetValue("WhitelistedHardcodedSubs", value); }
}
public bool RemoveCompletedDownloads
{
get { return GetValueBoolean("RemoveCompletedDownloads", false); }
set { SetValue("RemoveCompletedDownloads", value); }
}
public bool AutoRedownloadFailed
{
get { return GetValueBoolean("AutoRedownloadFailed", true); }
set { SetValue("AutoRedownloadFailed", value); }
}
public bool RemoveFailedDownloads
{
get { return GetValueBoolean("RemoveFailedDownloads", true); }
set { SetValue("RemoveFailedDownloads", value); }
}
public string DownloadClientWorkingFolders
{
get { return GetValue("DownloadClientWorkingFolders", "_UNPACK_|_FAILED_"); }
set { SetValue("DownloadClientWorkingFolders", value); }
}
public int CheckForFinishedDownloadInterval
{
get { return GetValueInt("CheckForFinishedDownloadInterval", 1); }
set { SetValue("CheckForFinishedDownloadInterval", value); }
}
public int DownloadClientHistoryLimit
{
get { return GetValueInt("DownloadClientHistoryLimit", 30); }
set { SetValue("DownloadClientHistoryLimit", value); }
}
public int FirstDayOfWeek
{
get { return GetValueInt("FirstDayOfWeek", (int)CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek); }
@ -273,13 +159,6 @@ namespace NzbDrone.Core.Configuration
set { SetValue("UILanguage", value); }
}
public bool CleanupMetadataImages
{
get { return GetValueBoolean("CleanupMetadataImages", true); }
set { SetValue("CleanupMetadataImages", value); }
}
public string PlexClientIdentifier => GetValue("PlexClientIdentifier", Guid.NewGuid().ToString(), true);
public string RijndaelPassphrase => GetValue("RijndaelPassphrase", Guid.NewGuid().ToString(), true);

@ -12,36 +12,10 @@ namespace NzbDrone.Core.Configuration
//Download Client
string DownloadClientWorkingFolders { get; set; }
int DownloadClientHistoryLimit { get; set; }
int CheckForFinishedDownloadInterval { get; set; }
//Completed/Failed Download Handling (Download client)
bool EnableCompletedDownloadHandling { get; set; }
bool RemoveCompletedDownloads { get; set; }
bool AutoRedownloadFailed { get; set; }
bool RemoveFailedDownloads { get; set; }
//History
int HistoryCleanupDays { get; set; }
//Indexers
int Retention { get; set; }
int RssSyncInterval { get; set; }
int MaximumSize { get; set; }
int MinimumAge { get; set; }
bool PreferIndexerFlags { get; set; }
int AvailabilityDelay { get; set; }
bool AllowHardcodedSubs { get; set; }
string WhitelistedHardcodedSubs { get; set; }
int ImportListSyncInterval { get; set; }
string ListSyncLevel { get; set; }
string ImportExclusions { get; set; }
//UI
int FirstDayOfWeek { get; set; }
string CalendarWeekColumnHeader { get; set; }
@ -55,7 +29,6 @@ namespace NzbDrone.Core.Configuration
int UILanguage { get; set; }
//Internal
bool CleanupMetadataImages { get; set; }
string PlexClientIdentifier { get; }
//Forms Auth

@ -6,13 +6,6 @@ namespace Prowlarr.Api.V1.Config
public class DownloadClientConfigResource : RestResource
{
public string DownloadClientWorkingFolders { get; set; }
public bool EnableCompletedDownloadHandling { get; set; }
public bool RemoveCompletedDownloads { get; set; }
public int CheckForFinishedDownloadInterval { get; set; }
public bool AutoRedownloadFailed { get; set; }
public bool RemoveFailedDownloads { get; set; }
}
public static class DownloadClientConfigResourceMapper
@ -21,14 +14,7 @@ namespace Prowlarr.Api.V1.Config
{
return new DownloadClientConfigResource
{
DownloadClientWorkingFolders = model.DownloadClientWorkingFolders,
EnableCompletedDownloadHandling = model.EnableCompletedDownloadHandling,
RemoveCompletedDownloads = model.RemoveCompletedDownloads,
CheckForFinishedDownloadInterval = model.CheckForFinishedDownloadInterval,
AutoRedownloadFailed = model.AutoRedownloadFailed,
RemoveFailedDownloads = model.RemoveFailedDownloads
DownloadClientWorkingFolders = model.DownloadClientWorkingFolders
};
}
}

@ -1,32 +0,0 @@
using FluentValidation;
using NzbDrone.Core.Configuration;
using Prowlarr.Http;
using Prowlarr.Http.Validation;
namespace Prowlarr.Api.V1.Config
{
[V1ApiController("config/indexer")]
public class IndexerConfigController : ConfigController<IndexerConfigResource>
{
public IndexerConfigController(IConfigService configService)
: base(configService)
{
SharedValidator.RuleFor(c => c.MinimumAge)
.GreaterThanOrEqualTo(0);
SharedValidator.RuleFor(c => c.MaximumSize)
.GreaterThanOrEqualTo(0);
SharedValidator.RuleFor(c => c.Retention)
.GreaterThanOrEqualTo(0);
SharedValidator.RuleFor(c => c.RssSyncInterval)
.IsValidRssSyncInterval();
}
protected override IndexerConfigResource ToResource(IConfigService model)
{
return IndexerConfigResourceMapper.ToResource(model);
}
}
}

@ -1,35 +0,0 @@
using NzbDrone.Core.Configuration;
using Prowlarr.Http.REST;
namespace Prowlarr.Api.V1.Config
{
public class IndexerConfigResource : RestResource
{
public int MinimumAge { get; set; }
public int MaximumSize { get; set; }
public int Retention { get; set; }
public int RssSyncInterval { get; set; }
public bool PreferIndexerFlags { get; set; }
public int AvailabilityDelay { get; set; }
public bool AllowHardcodedSubs { get; set; }
public string WhitelistedHardcodedSubs { get; set; }
}
public static class IndexerConfigResourceMapper
{
public static IndexerConfigResource ToResource(IConfigService model)
{
return new IndexerConfigResource
{
MinimumAge = model.MinimumAge,
MaximumSize = model.MaximumSize,
Retention = model.Retention,
RssSyncInterval = model.RssSyncInterval,
PreferIndexerFlags = model.PreferIndexerFlags,
AvailabilityDelay = model.AvailabilityDelay,
AllowHardcodedSubs = model.AllowHardcodedSubs,
WhitelistedHardcodedSubs = model.WhitelistedHardcodedSubs,
};
}
}
}
Loading…
Cancel
Save