Your ROOT_URL in app.ini is https://git.cloudchain.link/ but you are visiting https://dash.bss.nz/open-source-mirrors/recyclarr/commit/73fb40de04ec219d6045e98181448515ca497801 You should set ROOT_URL correctly, otherwise the web may not work correctly.

refactor: Move CF config objects to ServiceConfiguration

pull/124/head
Robert Dailey 3 years ago
parent 77f15b7e79
commit 73fb40de04

@ -50,6 +50,8 @@ public class ConfigurationLoaderTest
{
public string BaseUrl => "";
public string ApiKey => "";
public ICollection<CustomFormatConfig> CustomFormats => new List<CustomFormatConfig>();
public bool DeleteOldCustomFormats => false;
}
[Test, AutoMockData(typeof(ConfigurationLoaderTest), nameof(BuildContainer))]

@ -6,12 +6,12 @@ using NSubstitute;
using NUnit.Framework;
using Serilog;
using TestLibrary.FluentAssertions;
using TrashLib.Config.Services;
using TrashLib.Services.CustomFormat.Guide;
using TrashLib.Services.CustomFormat.Models;
using TrashLib.Services.CustomFormat.Processors;
using TrashLib.Services.CustomFormat.Processors.GuideSteps;
using TrashLib.Services.Radarr;
using TrashLib.Services.Radarr.Config;
using TrashLib.TestLibrary;
namespace TrashLib.Tests.CustomFormat.Processors;

@ -2,10 +2,10 @@ using FluentAssertions;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using TestLibrary.AutoFixture;
using TrashLib.Config.Services;
using TrashLib.Services.CustomFormat.Models;
using TrashLib.Services.CustomFormat.Models.Cache;
using TrashLib.Services.CustomFormat.Processors.GuideSteps;
using TrashLib.Services.Radarr.Config;
using TrashLib.TestLibrary;
namespace TrashLib.Tests.CustomFormat.Processors.GuideSteps;

@ -4,10 +4,10 @@ using Newtonsoft.Json.Linq;
using NUnit.Framework;
using TestLibrary.AutoFixture;
using TestLibrary.FluentAssertions;
using TrashLib.Config.Services;
using TrashLib.Services.CustomFormat.Models;
using TrashLib.Services.CustomFormat.Models.Cache;
using TrashLib.Services.CustomFormat.Processors.GuideSteps;
using TrashLib.Services.Radarr.Config;
using TrashLib.TestLibrary;
namespace TrashLib.Tests.CustomFormat.Processors.GuideSteps;

@ -1,8 +1,8 @@
using FluentAssertions;
using NUnit.Framework;
using TrashLib.Config.Services;
using TrashLib.Services.CustomFormat.Models;
using TrashLib.Services.CustomFormat.Processors.GuideSteps;
using TrashLib.Services.Radarr.Config;
using TrashLib.TestLibrary;
namespace TrashLib.Tests.CustomFormat.Processors.GuideSteps;

@ -4,6 +4,7 @@ using FluentAssertions;
using FluentValidation;
using NUnit.Framework;
using TrashLib.Config;
using TrashLib.Config.Services;
using TrashLib.Services.Radarr;
using TrashLib.Services.Radarr.Config;

@ -8,8 +8,8 @@ using Newtonsoft.Json.Serialization;
using NSubstitute;
using NUnit.Framework;
using TestLibrary.AutoFixture;
using TrashLib.Config.Services;
using TrashLib.ExceptionTypes;
using TrashLib.Services.Radarr.Config;
using TrashLib.Services.Sonarr;
using TrashLib.Services.Sonarr.Api;
using TrashLib.Services.Sonarr.Api.Objects;

@ -4,4 +4,6 @@ public interface IServiceConfiguration
{
string BaseUrl { get; }
string ApiKey { get; }
ICollection<CustomFormatConfig> CustomFormats { get; }
bool DeleteOldCustomFormats { get; }
}

@ -1,7 +1,27 @@
using JetBrains.Annotations;
namespace TrashLib.Config.Services;
public abstract class ServiceConfiguration : IServiceConfiguration
{
public string BaseUrl { get; init; } = "";
public string ApiKey { get; init; } = "";
public ICollection<CustomFormatConfig> CustomFormats { get; init; } = new List<CustomFormatConfig>();
public bool DeleteOldCustomFormats { get; init; }
}
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
public class CustomFormatConfig
{
public ICollection<string> Names { get; init; } = new List<string>();
public ICollection<string> TrashIds { get; init; } = new List<string>();
public ICollection<QualityProfileConfig> QualityProfiles { get; init; } = new List<QualityProfileConfig>();
}
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
public class QualityProfileConfig
{
public string Name { get; init; } = "";
public int? Score { get; init; }
public bool ResetUnmatchedScores { get; init; }
}

@ -4,7 +4,6 @@ using Serilog;
using TrashLib.Config.Services;
using TrashLib.Services.CustomFormat.Processors;
using TrashLib.Services.CustomFormat.Processors.PersistenceSteps;
using TrashLib.Services.Radarr.Config;
namespace TrashLib.Services.CustomFormat;

@ -1,4 +1,4 @@
using TrashLib.Services.Radarr.Config;
using TrashLib.Config.Services;
namespace TrashLib.Services.CustomFormat;

@ -1,4 +1,4 @@
using TrashLib.Services.Radarr.Config;
using TrashLib.Config.Services;
namespace TrashLib.Services.CustomFormat.Models;

@ -1,8 +1,8 @@
using TrashLib.Config.Services;
using TrashLib.Services.CustomFormat.Models;
using TrashLib.Services.CustomFormat.Models.Cache;
using TrashLib.Services.CustomFormat.Processors.GuideSteps;
using TrashLib.Services.Radarr;
using TrashLib.Services.Radarr.Config;
namespace TrashLib.Services.CustomFormat.Processors;

@ -1,7 +1,7 @@
using Common.Extensions;
using Serilog;
using TrashLib.Config.Services;
using TrashLib.Services.CustomFormat.Models;
using TrashLib.Services.Radarr.Config;
namespace TrashLib.Services.CustomFormat.Processors.GuideSteps;

@ -1,7 +1,7 @@
using Common.Extensions;
using TrashLib.Config.Services;
using TrashLib.Services.CustomFormat.Models;
using TrashLib.Services.CustomFormat.Models.Cache;
using TrashLib.Services.Radarr.Config;
namespace TrashLib.Services.CustomFormat.Processors.GuideSteps;

@ -1,5 +1,5 @@
using TrashLib.Config.Services;
using TrashLib.Services.CustomFormat.Models;
using TrashLib.Services.Radarr.Config;
namespace TrashLib.Services.CustomFormat.Processors.GuideSteps;

@ -1,6 +1,6 @@
using TrashLib.Config.Services;
using TrashLib.Services.CustomFormat.Models;
using TrashLib.Services.CustomFormat.Models.Cache;
using TrashLib.Services.Radarr.Config;
namespace TrashLib.Services.CustomFormat.Processors.GuideSteps;

@ -1,6 +1,6 @@
using TrashLib.Config.Services;
using TrashLib.Services.CustomFormat.Models;
using TrashLib.Services.CustomFormat.Models.Cache;
using TrashLib.Services.Radarr.Config;
namespace TrashLib.Services.CustomFormat.Processors;

@ -3,7 +3,6 @@ using TrashLib.Services.CustomFormat.Api;
using TrashLib.Services.CustomFormat.Models;
using TrashLib.Services.CustomFormat.Models.Cache;
using TrashLib.Services.CustomFormat.Processors.PersistenceSteps;
using TrashLib.Services.Radarr.Config;
namespace TrashLib.Services.CustomFormat.Processors;
@ -61,7 +60,7 @@ internal class PersistenceProcessor : IPersistenceProcessor
_steps.JsonTransactionStep.Process(guideCfs, radarrCfs);
// Step 1.1: Optionally record deletions of custom formats in cache but not in the guide
var config = (RadarrConfiguration) _configProvider.ActiveConfiguration;
var config = _configProvider.ActiveConfiguration;
if (config.DeleteOldCustomFormats)
{
_steps.JsonTransactionStep.RecordDeletions(deletedCfsInCache, radarrCfs);

@ -7,24 +7,6 @@ namespace TrashLib.Services.Radarr.Config;
public class RadarrConfiguration : ServiceConfiguration
{
public QualityDefinitionConfig? QualityDefinition { get; init; }
public ICollection<CustomFormatConfig> CustomFormats { get; init; } = new List<CustomFormatConfig>();
public bool DeleteOldCustomFormats { get; init; }
}
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
public class CustomFormatConfig
{
public ICollection<string> Names { get; init; } = new List<string>();
public ICollection<string> TrashIds { get; init; } = new List<string>();
public ICollection<QualityProfileConfig> QualityProfiles { get; init; } = new List<QualityProfileConfig>();
}
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
public class QualityProfileConfig
{
public string Name { get; init; } = "";
public int? Score { get; init; }
public bool ResetUnmatchedScores { get; init; }
}
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]

@ -1,6 +1,7 @@
using Common.FluentValidation;
using FluentValidation;
using JetBrains.Annotations;
using TrashLib.Config.Services;
namespace TrashLib.Services.Radarr.Config;

@ -1,12 +1,10 @@
using TrashLib.Config.Services;
using TrashLib.Services.Radarr.Config;
namespace TrashLib.Services.Sonarr.Config;
public class SonarrConfiguration : ServiceConfiguration
{
public IList<ReleaseProfileConfig> ReleaseProfiles { get; init; } = Array.Empty<ReleaseProfileConfig>();
public ICollection<CustomFormatConfig> CustomFormats { get; init; } = new List<CustomFormatConfig>();
public string QualityDefinition { get; init; } = "";
}

Loading…
Cancel
Save