diff --git a/src/Trash.Tests/Extensions/DictionaryExtensionsTest.cs b/src/Common.Tests/Extensions/DictionaryExtensionsTest.cs
similarity index 94%
rename from src/Trash.Tests/Extensions/DictionaryExtensionsTest.cs
rename to src/Common.Tests/Extensions/DictionaryExtensionsTest.cs
index 5ba010c0..bab1fd76 100644
--- a/src/Trash.Tests/Extensions/DictionaryExtensionsTest.cs
+++ b/src/Common.Tests/Extensions/DictionaryExtensionsTest.cs
@@ -1,9 +1,9 @@
using System.Collections.Generic;
+using Common.Extensions;
using FluentAssertions;
using NUnit.Framework;
-using Trash.Extensions;
-namespace Trash.Tests.Extensions
+namespace Common.Tests.Extensions
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Common/Common.csproj b/src/Common/Common.csproj
index 35e3d842..4fdad984 100644
--- a/src/Common/Common.csproj
+++ b/src/Common/Common.csproj
@@ -1,2 +1,5 @@
+
+
+
diff --git a/src/Trash/Extensions/DictionaryExtensions.cs b/src/Common/Extensions/DictionaryExtensions.cs
similarity index 95%
rename from src/Trash/Extensions/DictionaryExtensions.cs
rename to src/Common/Extensions/DictionaryExtensions.cs
index a42a1193..d93d5458 100644
--- a/src/Trash/Extensions/DictionaryExtensions.cs
+++ b/src/Common/Extensions/DictionaryExtensions.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Trash.Extensions
+namespace Common.Extensions
{
public static class DictionaryExtensions
{
diff --git a/src/Trash/Extensions/LinqExtensions.cs b/src/Common/Extensions/LinqExtensions.cs
similarity index 98%
rename from src/Trash/Extensions/LinqExtensions.cs
rename to src/Common/Extensions/LinqExtensions.cs
index 9f6e832b..e5e0dd8e 100644
--- a/src/Trash/Extensions/LinqExtensions.cs
+++ b/src/Common/Extensions/LinqExtensions.cs
@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
-namespace Trash.Extensions
+namespace Common.Extensions
{
internal static class LinqExtensions
{
diff --git a/src/Trash/Extensions/RegexExtensions.cs b/src/Common/Extensions/RegexExtensions.cs
similarity index 95%
rename from src/Trash/Extensions/RegexExtensions.cs
rename to src/Common/Extensions/RegexExtensions.cs
index 8cc5c010..e4c3d1c2 100644
--- a/src/Trash/Extensions/RegexExtensions.cs
+++ b/src/Common/Extensions/RegexExtensions.cs
@@ -1,7 +1,7 @@
using System.Diagnostics.CodeAnalysis;
using System.Text.RegularExpressions;
-namespace Trash.Extensions
+namespace Common.Extensions
{
public static class RegexExtensions
{
diff --git a/src/Trash/Extensions/StringExtensions.cs b/src/Common/Extensions/StringExtensions.cs
similarity index 97%
rename from src/Trash/Extensions/StringExtensions.cs
rename to src/Common/Extensions/StringExtensions.cs
index 96de8057..4dca069d 100644
--- a/src/Trash/Extensions/StringExtensions.cs
+++ b/src/Common/Extensions/StringExtensions.cs
@@ -1,7 +1,7 @@
using System;
using System.Globalization;
-namespace Trash.Extensions
+namespace Common.Extensions
{
public static class StringExtensions
{
diff --git a/src/Trash/YamlDotNet/CannotBeEmptyAttribute.cs b/src/Common/YamlDotNet/CannotBeEmptyAttribute.cs
similarity index 93%
rename from src/Trash/YamlDotNet/CannotBeEmptyAttribute.cs
rename to src/Common/YamlDotNet/CannotBeEmptyAttribute.cs
index cb3df545..f47c75ef 100644
--- a/src/Trash/YamlDotNet/CannotBeEmptyAttribute.cs
+++ b/src/Common/YamlDotNet/CannotBeEmptyAttribute.cs
@@ -2,7 +2,7 @@ using System;
using System.Collections;
using System.ComponentModel.DataAnnotations;
-namespace Trash.YamlDotNet
+namespace Common.YamlDotNet
{
[AttributeUsage(AttributeTargets.Property)]
public sealed class CannotBeEmptyAttribute : RequiredAttribute
diff --git a/src/Trash/YamlDotNet/ValidatingDeserializer.cs b/src/Common/YamlDotNet/ValidatingDeserializer.cs
similarity index 92%
rename from src/Trash/YamlDotNet/ValidatingDeserializer.cs
rename to src/Common/YamlDotNet/ValidatingDeserializer.cs
index c057255c..b88fefb5 100644
--- a/src/Trash/YamlDotNet/ValidatingDeserializer.cs
+++ b/src/Common/YamlDotNet/ValidatingDeserializer.cs
@@ -3,9 +3,9 @@ using System.ComponentModel.DataAnnotations;
using YamlDotNet.Core;
using YamlDotNet.Serialization;
-namespace Trash.YamlDotNet
+namespace Common.YamlDotNet
{
- public class ValidatingDeserializer : INodeDeserializer
+ internal class ValidatingDeserializer : INodeDeserializer
{
private readonly INodeDeserializer _nodeDeserializer;
diff --git a/src/Trash/YamlDotNet/YamlDotNetExtensions.cs b/src/Common/YamlDotNet/YamlDotNetExtensions.cs
similarity index 97%
rename from src/Trash/YamlDotNet/YamlDotNetExtensions.cs
rename to src/Common/YamlDotNet/YamlDotNetExtensions.cs
index 1e28f5e1..34ef716e 100644
--- a/src/Trash/YamlDotNet/YamlDotNetExtensions.cs
+++ b/src/Common/YamlDotNet/YamlDotNetExtensions.cs
@@ -2,7 +2,7 @@
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NodeDeserializers;
-namespace Trash.YamlDotNet
+namespace Common.YamlDotNet
{
public static class YamlDotNetExtensions
{
diff --git a/src/Trash/YamlDotNet/YamlNullableEnumTypeConverter.cs b/src/Common/YamlDotNet/YamlNullableEnumTypeConverter.cs
similarity index 95%
rename from src/Trash/YamlDotNet/YamlNullableEnumTypeConverter.cs
rename to src/Common/YamlDotNet/YamlNullableEnumTypeConverter.cs
index ec48776b..99dca28c 100644
--- a/src/Trash/YamlDotNet/YamlNullableEnumTypeConverter.cs
+++ b/src/Common/YamlDotNet/YamlNullableEnumTypeConverter.cs
@@ -3,11 +3,11 @@ using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Serialization;
-namespace Trash.YamlDotNet
+namespace Common.YamlDotNet
{
// A workaround for nullable enums in YamlDotNet taken from:
// https://github.com/aaubry/YamlDotNet/issues/544#issuecomment-778062351
- internal class YamlNullableEnumTypeConverter : IYamlTypeConverter
+ public class YamlNullableEnumTypeConverter : IYamlTypeConverter
{
public bool Accepts(Type type)
{
diff --git a/src/Trash.TestLibrary/CfTestUtils.cs b/src/Trash.TestLibrary/CfTestUtils.cs
index c50b3328..f22c10ce 100644
--- a/src/Trash.TestLibrary/CfTestUtils.cs
+++ b/src/Trash.TestLibrary/CfTestUtils.cs
@@ -1,5 +1,5 @@
using System.Linq;
-using Trash.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models;
namespace Trash.TestLibrary
{
diff --git a/src/Trash.Tests/Command/CliTypeActivatorTest.cs b/src/Trash.Tests/Command/CliTypeActivatorTest.cs
index 045fbb0f..94ad046f 100644
--- a/src/Trash.Tests/Command/CliTypeActivatorTest.cs
+++ b/src/Trash.Tests/Command/CliTypeActivatorTest.cs
@@ -3,7 +3,7 @@ using System.Collections.Generic;
using Autofac;
using FluentAssertions;
using NUnit.Framework;
-using Trash.Command;
+using Trash.Command.Helpers;
namespace Trash.Tests.Command
{
diff --git a/src/Trash.Tests/Config/ConfigurationLoaderTest.cs b/src/Trash.Tests/Config/ConfigurationLoaderTest.cs
index 4f485500..0923ff5a 100644
--- a/src/Trash.Tests/Config/ConfigurationLoaderTest.cs
+++ b/src/Trash.Tests/Config/ConfigurationLoaderTest.cs
@@ -6,15 +6,16 @@ using System.IO.Abstractions;
using System.Linq;
using System.Text;
using Common;
+using Common.Extensions;
using FluentAssertions;
using JetBrains.Annotations;
using NSubstitute;
using NUnit.Framework;
using TestLibrary;
using Trash.Config;
-using Trash.Extensions;
-using Trash.Sonarr;
-using Trash.Sonarr.ReleaseProfile;
+using TrashLib.Config;
+using TrashLib.Sonarr;
+using TrashLib.Sonarr.ReleaseProfile;
using YamlDotNet.Serialization.ObjectFactories;
namespace Trash.Tests.Config
@@ -38,16 +39,16 @@ namespace Trash.Tests.Config
public string BaseUrl { get; init; } = "";
public string ApiKey { get; init; } = "";
- public string BuildUrl()
- {
- throw new NotImplementedException();
- }
-
public bool IsValid(out string msg)
{
msg = Msg;
return false;
}
+
+ public string BuildUrl()
+ {
+ throw new NotImplementedException();
+ }
}
[SuppressMessage("Microsoft.Design", "CA1034",
@@ -58,16 +59,16 @@ namespace Trash.Tests.Config
public string BaseUrl { get; init; } = "";
public string ApiKey { get; init; } = "";
- public string BuildUrl()
- {
- throw new NotImplementedException();
- }
-
public bool IsValid(out string msg)
{
msg = "";
return true;
}
+
+ public string BuildUrl()
+ {
+ throw new NotImplementedException();
+ }
}
[Test]
diff --git a/src/Trash.Tests/Config/ServiceConfigurationTest.cs b/src/Trash.Tests/Config/ServiceConfigurationTest.cs
index 3f1ee177..9a2b1107 100644
--- a/src/Trash.Tests/Config/ServiceConfigurationTest.cs
+++ b/src/Trash.Tests/Config/ServiceConfigurationTest.cs
@@ -6,6 +6,7 @@ using JetBrains.Annotations;
using NSubstitute;
using NUnit.Framework;
using Trash.Config;
+using TrashLib.Config;
using YamlDotNet.Core;
using YamlDotNet.Serialization.ObjectFactories;
diff --git a/src/Trash.Tests/CreateConfig/CreateConfigCommandTest.cs b/src/Trash.Tests/CreateConfig/CreateConfigCommandTest.cs
index f6dbb829..ee4124df 100644
--- a/src/Trash.Tests/CreateConfig/CreateConfigCommandTest.cs
+++ b/src/Trash.Tests/CreateConfig/CreateConfigCommandTest.cs
@@ -4,7 +4,7 @@ using CliFx.Infrastructure;
using NSubstitute;
using NUnit.Framework;
using Serilog;
-using Trash.CreateConfig;
+using Trash.Command;
// ReSharper disable MethodHasAsyncOverload
diff --git a/src/Trash/CreateConfig/CreateConfigCommand.cs b/src/Trash/Command/CreateConfigCommand.cs
similarity index 98%
rename from src/Trash/CreateConfig/CreateConfigCommand.cs
rename to src/Trash/Command/CreateConfigCommand.cs
index 1d66c4b8..b67c53fb 100644
--- a/src/Trash/CreateConfig/CreateConfigCommand.cs
+++ b/src/Trash/Command/CreateConfigCommand.cs
@@ -8,7 +8,7 @@ using Common;
using JetBrains.Annotations;
using Serilog;
-namespace Trash.CreateConfig
+namespace Trash.Command
{
[Command("create-config", Description = "Create a starter YAML configuration file")]
[UsedImplicitly]
diff --git a/src/Trash/Command/ActiveServiceCommandProvider.cs b/src/Trash/Command/Helpers/ActiveServiceCommandProvider.cs
similarity index 92%
rename from src/Trash/Command/ActiveServiceCommandProvider.cs
rename to src/Trash/Command/Helpers/ActiveServiceCommandProvider.cs
index 31c2fa69..d42a470d 100644
--- a/src/Trash/Command/ActiveServiceCommandProvider.cs
+++ b/src/Trash/Command/Helpers/ActiveServiceCommandProvider.cs
@@ -1,6 +1,6 @@
using System;
-namespace Trash.Command
+namespace Trash.Command.Helpers
{
public class ActiveServiceCommandProvider : IActiveServiceCommandProvider
{
diff --git a/src/Trash/Cache/CacheStoragePath.cs b/src/Trash/Command/Helpers/CacheStoragePath.cs
similarity index 84%
rename from src/Trash/Cache/CacheStoragePath.cs
rename to src/Trash/Command/Helpers/CacheStoragePath.cs
index b696e381..7c8f6008 100644
--- a/src/Trash/Cache/CacheStoragePath.cs
+++ b/src/Trash/Command/Helpers/CacheStoragePath.cs
@@ -1,7 +1,7 @@
using System;
-using Trash.Command;
+using TrashLib.Cache;
-namespace Trash.Cache
+namespace Trash.Command.Helpers
{
public class CacheStoragePath : ICacheStoragePath
{
diff --git a/src/Trash/Command/CliTypeActivator.cs b/src/Trash/Command/Helpers/CliTypeActivator.cs
similarity index 94%
rename from src/Trash/Command/CliTypeActivator.cs
rename to src/Trash/Command/Helpers/CliTypeActivator.cs
index fdbfd26f..939e1e62 100644
--- a/src/Trash/Command/CliTypeActivator.cs
+++ b/src/Trash/Command/Helpers/CliTypeActivator.cs
@@ -1,7 +1,7 @@
using System;
using Autofac;
-namespace Trash.Command
+namespace Trash.Command.Helpers
{
internal static class CliTypeActivator
{
diff --git a/src/Trash/Command/ExitCode.cs b/src/Trash/Command/Helpers/ExitCode.cs
similarity index 70%
rename from src/Trash/Command/ExitCode.cs
rename to src/Trash/Command/Helpers/ExitCode.cs
index 144451af..a1f1be28 100644
--- a/src/Trash/Command/ExitCode.cs
+++ b/src/Trash/Command/Helpers/ExitCode.cs
@@ -1,4 +1,4 @@
-namespace Trash.Command
+namespace Trash.Command.Helpers
{
public enum ExitCode
{
diff --git a/src/Trash/Command/IActiveServiceCommandProvider.cs b/src/Trash/Command/Helpers/IActiveServiceCommandProvider.cs
similarity index 77%
rename from src/Trash/Command/IActiveServiceCommandProvider.cs
rename to src/Trash/Command/Helpers/IActiveServiceCommandProvider.cs
index 7161ad31..f152ce58 100644
--- a/src/Trash/Command/IActiveServiceCommandProvider.cs
+++ b/src/Trash/Command/Helpers/IActiveServiceCommandProvider.cs
@@ -1,4 +1,4 @@
-namespace Trash.Command
+namespace Trash.Command.Helpers
{
public interface IActiveServiceCommandProvider
{
diff --git a/src/Trash/Command/IServiceCommand.cs b/src/Trash/Command/Helpers/IServiceCommand.cs
similarity index 88%
rename from src/Trash/Command/IServiceCommand.cs
rename to src/Trash/Command/Helpers/IServiceCommand.cs
index 16da8af2..4d217c49 100644
--- a/src/Trash/Command/IServiceCommand.cs
+++ b/src/Trash/Command/Helpers/IServiceCommand.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Trash.Command
+namespace Trash.Command.Helpers
{
public interface IServiceCommand
{
diff --git a/src/Trash/Command/ServiceCommand.cs b/src/Trash/Command/Helpers/ServiceCommand.cs
similarity index 99%
rename from src/Trash/Command/ServiceCommand.cs
rename to src/Trash/Command/Helpers/ServiceCommand.cs
index d8b51aa6..521d3466 100644
--- a/src/Trash/Command/ServiceCommand.cs
+++ b/src/Trash/Command/Helpers/ServiceCommand.cs
@@ -14,7 +14,7 @@ using Serilog.Core;
using Serilog.Events;
using YamlDotNet.Core;
-namespace Trash.Command
+namespace Trash.Command.Helpers
{
public abstract class ServiceCommand : ICommand, IServiceCommand
{
diff --git a/src/Trash/Radarr/RadarrCommand.cs b/src/Trash/Command/RadarrCommand.cs
similarity index 79%
rename from src/Trash/Radarr/RadarrCommand.cs
rename to src/Trash/Command/RadarrCommand.cs
index 3c984279..d3c2e70a 100644
--- a/src/Trash/Radarr/RadarrCommand.cs
+++ b/src/Trash/Command/RadarrCommand.cs
@@ -6,27 +6,28 @@ using Flurl.Http;
using JetBrains.Annotations;
using Serilog;
using Serilog.Core;
-using Trash.Command;
+using Trash.Command.Helpers;
using Trash.Config;
-using Trash.Radarr.CustomFormat;
-using Trash.Radarr.QualityDefinition;
+using TrashLib.Radarr;
+using TrashLib.Radarr.CustomFormat;
+using TrashLib.Radarr.QualityDefinition;
-namespace Trash.Radarr
+namespace Trash.Command
{
[Command("radarr", Description = "Perform operations on a Radarr instance")]
[UsedImplicitly]
- public class RadarrCommand : ServiceCommand, IRadarrCommand
+ public class RadarrCommand : ServiceCommand
{
private readonly IConfigurationLoader _configLoader;
private readonly Func _customFormatUpdaterFactory;
- private readonly Func _qualityUpdaterFactory;
+ private readonly Func _qualityUpdaterFactory;
public RadarrCommand(
ILogger logger,
LoggingLevelSwitch loggingLevelSwitch,
ILogJanitor logJanitor,
IConfigurationLoader configLoader,
- Func qualityUpdaterFactory,
+ Func qualityUpdaterFactory,
Func customFormatUpdaterFactory)
: base(logger, loggingLevelSwitch, logJanitor)
{
@@ -46,12 +47,12 @@ namespace Trash.Radarr
{
if (config.QualityDefinition != null)
{
- await _qualityUpdaterFactory().Process(this, config);
+ await _qualityUpdaterFactory().Process(Preview, config);
}
if (config.CustomFormats.Count > 0)
{
- await _customFormatUpdaterFactory().Process(this, config);
+ await _customFormatUpdaterFactory().Process(Preview, config);
}
}
}
diff --git a/src/Trash/Sonarr/SonarrCommand.cs b/src/Trash/Command/SonarrCommand.cs
similarity index 71%
rename from src/Trash/Sonarr/SonarrCommand.cs
rename to src/Trash/Command/SonarrCommand.cs
index 83a8b982..bf05f1f8 100644
--- a/src/Trash/Sonarr/SonarrCommand.cs
+++ b/src/Trash/Command/SonarrCommand.cs
@@ -6,28 +6,29 @@ using Flurl.Http;
using JetBrains.Annotations;
using Serilog;
using Serilog.Core;
-using Trash.Command;
+using Trash.Command.Helpers;
using Trash.Config;
-using Trash.Sonarr.QualityDefinition;
-using Trash.Sonarr.ReleaseProfile;
+using TrashLib.Sonarr;
+using TrashLib.Sonarr.QualityDefinition;
+using TrashLib.Sonarr.ReleaseProfile;
-namespace Trash.Sonarr
+namespace Trash.Command
{
[Command("sonarr", Description = "Perform operations on a Sonarr instance")]
[UsedImplicitly]
- public class SonarrCommand : ServiceCommand, ISonarrCommand
+ public class SonarrCommand : ServiceCommand
{
private readonly IConfigurationLoader _configLoader;
- private readonly Func _profileUpdaterFactory;
- private readonly Func _qualityUpdaterFactory;
+ private readonly Func _profileUpdaterFactory;
+ private readonly Func _qualityUpdaterFactory;
public SonarrCommand(
ILogger logger,
LoggingLevelSwitch loggingLevelSwitch,
ILogJanitor logJanitor,
IConfigurationLoader configLoader,
- Func profileUpdaterFactory,
- Func qualityUpdaterFactory)
+ Func profileUpdaterFactory,
+ Func qualityUpdaterFactory)
: base(logger, loggingLevelSwitch, logJanitor)
{
_configLoader = configLoader;
@@ -48,12 +49,12 @@ namespace Trash.Sonarr
{
if (config.ReleaseProfiles.Count > 0)
{
- await _profileUpdaterFactory().Process(this, config);
+ await _profileUpdaterFactory().Process(Preview, config);
}
if (config.QualityDefinition.HasValue)
{
- await _qualityUpdaterFactory().Process(this, config);
+ await _qualityUpdaterFactory().Process(Preview, config);
}
}
}
diff --git a/src/Trash/CompositionRoot.cs b/src/Trash/CompositionRoot.cs
index 489e8163..e5c315ac 100644
--- a/src/Trash/CompositionRoot.cs
+++ b/src/Trash/CompositionRoot.cs
@@ -3,24 +3,15 @@ using System.IO;
using System.IO.Abstractions;
using System.Reflection;
using Autofac;
-using Autofac.Extras.AggregateService;
using CliFx;
using Serilog;
using Serilog.Core;
-using Trash.Cache;
-using Trash.Command;
+using Trash.Command.Helpers;
using Trash.Config;
-using Trash.Radarr.CustomFormat;
-using Trash.Radarr.CustomFormat.Api;
-using Trash.Radarr.CustomFormat.Guide;
-using Trash.Radarr.CustomFormat.Processors;
-using Trash.Radarr.CustomFormat.Processors.GuideSteps;
-using Trash.Radarr.CustomFormat.Processors.PersistenceSteps;
-using Trash.Radarr.QualityDefinition;
-using Trash.Radarr.QualityDefinition.Api;
-using Trash.Sonarr.Api;
-using Trash.Sonarr.QualityDefinition;
-using Trash.Sonarr.ReleaseProfile;
+using TrashLib.Cache;
+using TrashLib.Config;
+using TrashLib.Radarr;
+using TrashLib.Sonarr;
using YamlDotNet.Serialization;
namespace Trash
@@ -48,69 +39,16 @@ namespace Trash
.SingleInstance();
}
- private static void SonarrRegistrations(ContainerBuilder builder)
- {
- builder.RegisterType().As();
-
- // Release Profile Support
- builder.RegisterType();
- builder.RegisterType().As();
-
- // Quality Definition Support
- builder.RegisterType();
- builder.RegisterType().As();
- }
-
- private static void RadarrRegistrations(ContainerBuilder builder)
- {
- // Services
- builder.RegisterType().As();
- builder.RegisterType().As();
- builder.RegisterType().As();
-
- builder.Register(c =>
- {
- var config = c.Resolve().ActiveConfiguration;
- return new ServerInfo(config.BaseUrl, config.ApiKey);
- })
- .As();
-
- // Quality Definition Support
- builder.RegisterType();
- builder.RegisterType().As();
-
- // Custom Format Support
- builder.RegisterType().As();
- builder.RegisterType().As();
- builder.RegisterType().As();
-
- // Guide Processor
- builder.RegisterType().As(); // todo: register as singleton to avoid parsing guide multiple times when using 2 or more instances in config
- builder.RegisterAggregateService();
- builder.RegisterType().As();
- builder.RegisterType().As();
- builder.RegisterType().As();
-
- // Persistence Processor
- builder.RegisterType().As();
- builder.RegisterAggregateService();
- builder.RegisterType().As();
- builder.RegisterType().As();
- builder.RegisterType().As();
- }
-
private static void ConfigurationRegistrations(ContainerBuilder builder)
{
+ builder.RegisterModule();
+
builder.RegisterType()
.As();
builder.RegisterGeneric(typeof(ConfigurationLoader<>))
.As(typeof(IConfigurationLoader<>));
- builder.RegisterType()
- .As()
- .SingleInstance();
-
// note: Do not allow consumers to resolve IServiceConfiguration directly; if this gets cached
// they end up using the wrong configuration when multiple instances are used.
// builder.Register(c => c.Resolve().ActiveConfiguration)
@@ -140,15 +78,17 @@ namespace Trash
public static IContainer Setup(ContainerBuilder builder)
{
builder.RegisterType().As();
- builder.RegisterType().As();
+
+ builder.RegisterModule();
builder.RegisterType().As();
ConfigurationRegistrations(builder);
CommandRegistrations(builder);
SetupLogging(builder);
- SonarrRegistrations(builder);
- RadarrRegistrations(builder);
+
+ builder.RegisterModule();
+ builder.RegisterModule();
// builder.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());
return builder.Build();
diff --git a/src/Trash/Config/ConfigurationLoader.cs b/src/Trash/Config/ConfigurationLoader.cs
index de08e353..c2f7f338 100644
--- a/src/Trash/Config/ConfigurationLoader.cs
+++ b/src/Trash/Config/ConfigurationLoader.cs
@@ -2,7 +2,8 @@
using System.IO;
using System.IO.Abstractions;
using System.Linq;
-using Trash.YamlDotNet;
+using Common.YamlDotNet;
+using TrashLib.Config;
using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Serialization;
diff --git a/src/Trash/Config/IConfigurationLoader.cs b/src/Trash/Config/IConfigurationLoader.cs
index 8a361f39..15fe6ba5 100644
--- a/src/Trash/Config/IConfigurationLoader.cs
+++ b/src/Trash/Config/IConfigurationLoader.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.IO;
+using TrashLib.Config;
namespace Trash.Config
{
diff --git a/src/Trash/Program.cs b/src/Trash/Program.cs
index 9e5dec72..e262b622 100644
--- a/src/Trash/Program.cs
+++ b/src/Trash/Program.cs
@@ -1,7 +1,7 @@
using System.Threading.Tasks;
using Autofac;
using CliFx;
-using Trash.Command;
+using Trash.Command.Helpers;
namespace Trash
{
diff --git a/src/Trash/Radarr/CustomFormat/ICustomFormatUpdater.cs b/src/Trash/Radarr/CustomFormat/ICustomFormatUpdater.cs
deleted file mode 100644
index b1a15c60..00000000
--- a/src/Trash/Radarr/CustomFormat/ICustomFormatUpdater.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using System.Threading.Tasks;
-using Trash.Command;
-
-namespace Trash.Radarr.CustomFormat
-{
- public interface ICustomFormatUpdater
- {
- Task Process(IServiceCommand args, RadarrConfiguration config);
- }
-}
diff --git a/src/Trash/Radarr/IRadarrCommand.cs b/src/Trash/Radarr/IRadarrCommand.cs
deleted file mode 100644
index 4b5cbd5e..00000000
--- a/src/Trash/Radarr/IRadarrCommand.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Trash.Command;
-
-namespace Trash.Radarr
-{
- public interface IRadarrCommand : IServiceCommand
- {
- }
-}
diff --git a/src/Trash/Sonarr/ISonarrCommand.cs b/src/Trash/Sonarr/ISonarrCommand.cs
deleted file mode 100644
index 85431fd9..00000000
--- a/src/Trash/Sonarr/ISonarrCommand.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-using Trash.Command;
-
-namespace Trash.Sonarr
-{
- public interface ISonarrCommand : IServiceCommand
- {
- }
-}
diff --git a/src/Trash/Trash.csproj b/src/Trash/Trash.csproj
index 9b8d7071..11396f6b 100644
--- a/src/Trash/Trash.csproj
+++ b/src/Trash/Trash.csproj
@@ -6,23 +6,19 @@
-
-
-
-
-
+
diff --git a/src/Trash.Tests/Cache/ServiceCacheTest.cs b/src/TrashLib.Tests/Cache/ServiceCacheTest.cs
similarity index 98%
rename from src/Trash.Tests/Cache/ServiceCacheTest.cs
rename to src/TrashLib.Tests/Cache/ServiceCacheTest.cs
index a1f3e981..74e6a845 100644
--- a/src/Trash.Tests/Cache/ServiceCacheTest.cs
+++ b/src/TrashLib.Tests/Cache/ServiceCacheTest.cs
@@ -9,10 +9,10 @@ using NSubstitute;
using NUnit.Framework;
using Serilog;
using TestLibrary.NSubstitute;
-using Trash.Cache;
-using Trash.Config;
+using TrashLib.Cache;
+using TrashLib.Config;
-namespace Trash.Tests.Cache
+namespace TrashLib.Tests.Cache
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/CustomFormat/CachePersisterTest.cs b/src/TrashLib.Tests/Radarr/CustomFormat/CachePersisterTest.cs
similarity index 95%
rename from src/Trash.Tests/Radarr/CustomFormat/CachePersisterTest.cs
rename to src/TrashLib.Tests/Radarr/CustomFormat/CachePersisterTest.cs
index c44dcbf2..397b1813 100644
--- a/src/Trash.Tests/Radarr/CustomFormat/CachePersisterTest.cs
+++ b/src/TrashLib.Tests/Radarr/CustomFormat/CachePersisterTest.cs
@@ -4,13 +4,13 @@ using Newtonsoft.Json.Linq;
using NSubstitute;
using NUnit.Framework;
using Serilog;
-using Trash.Cache;
-using Trash.Radarr.CustomFormat;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
-using Trash.Radarr.CustomFormat.Processors.PersistenceSteps;
+using TrashLib.Cache;
+using TrashLib.Radarr.CustomFormat;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps;
-namespace Trash.Tests.Radarr.CustomFormat
+namespace TrashLib.Tests.Radarr.CustomFormat
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequesterTest.cs b/src/TrashLib.Tests/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequesterTest.cs
similarity index 90%
rename from src/Trash.Tests/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequesterTest.cs
rename to src/TrashLib.Tests/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequesterTest.cs
index 2865e494..2aa9a90a 100644
--- a/src/Trash.Tests/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequesterTest.cs
+++ b/src/TrashLib.Tests/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequesterTest.cs
@@ -4,9 +4,9 @@ using System.Threading.Tasks;
using FluentAssertions;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
-using Trash.Radarr.CustomFormat.Guide;
+using TrashLib.Radarr.CustomFormat.Guide;
-namespace Trash.Tests.Radarr.CustomFormat.Guide
+namespace TrashLib.Tests.Radarr.CustomFormat.Guide
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat1.json b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat1.json
similarity index 100%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat1.json
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat1.json
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat1_Processed.json b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat1_Processed.json
similarity index 100%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat1_Processed.json
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat1_Processed.json
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat2.json b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat2.json
similarity index 100%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat2.json
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat2.json
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat2_Processed.json b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat2_Processed.json
similarity index 100%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat2_Processed.json
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/ImportableCustomFormat2_Processed.json
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/Data/NoScore.json b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/NoScore.json
similarity index 100%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/Data/NoScore.json
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/NoScore.json
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/Data/WontBeInConfig.json b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/WontBeInConfig.json
similarity index 100%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/Data/WontBeInConfig.json
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/Data/WontBeInConfig.json
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/GuideProcessorTest.cs b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideProcessorTest.cs
similarity index 96%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/GuideProcessorTest.cs
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideProcessorTest.cs
index 8d595adc..7be17746 100644
--- a/src/Trash.Tests/Radarr/CustomFormat/Processors/GuideProcessorTest.cs
+++ b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideProcessorTest.cs
@@ -7,14 +7,14 @@ using Newtonsoft.Json.Linq;
using NUnit.Framework;
using Serilog;
using TestLibrary.FluentAssertions;
-using Trash.Radarr;
-using Trash.Radarr.CustomFormat.Guide;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Processors;
-using Trash.Radarr.CustomFormat.Processors.GuideSteps;
using Trash.TestLibrary;
+using TrashLib.Radarr;
+using TrashLib.Radarr.CustomFormat.Guide;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Processors;
+using TrashLib.Radarr.CustomFormat.Processors.GuideSteps;
-namespace Trash.Tests.Radarr.CustomFormat.Processors
+namespace TrashLib.Tests.Radarr.CustomFormat.Processors
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/GuideSteps/ConfigStepTest.cs b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideSteps/ConfigStepTest.cs
similarity index 96%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/GuideSteps/ConfigStepTest.cs
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideSteps/ConfigStepTest.cs
index 1f64b5c4..71763f96 100644
--- a/src/Trash.Tests/Radarr/CustomFormat/Processors/GuideSteps/ConfigStepTest.cs
+++ b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideSteps/ConfigStepTest.cs
@@ -2,12 +2,12 @@ using System.Collections.Generic;
using FluentAssertions;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
-using Trash.Radarr;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
-using Trash.Radarr.CustomFormat.Processors.GuideSteps;
+using TrashLib.Radarr;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Processors.GuideSteps;
-namespace Trash.Tests.Radarr.CustomFormat.Processors.GuideSteps
+namespace TrashLib.Tests.Radarr.CustomFormat.Processors.GuideSteps
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStepTest.cs b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStepTest.cs
similarity index 98%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStepTest.cs
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStepTest.cs
index 6cd3ff61..6c7a4eaf 100644
--- a/src/Trash.Tests/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStepTest.cs
+++ b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStepTest.cs
@@ -5,12 +5,12 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using TestLibrary.FluentAssertions;
-using Trash.Radarr;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
-using Trash.Radarr.CustomFormat.Processors.GuideSteps;
+using TrashLib.Radarr;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Processors.GuideSteps;
-namespace Trash.Tests.Radarr.CustomFormat.Processors.GuideSteps
+namespace TrashLib.Tests.Radarr.CustomFormat.Processors.GuideSteps
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStepTest.cs b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStepTest.cs
similarity index 95%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStepTest.cs
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStepTest.cs
index 06d9f1b8..9d0baa8b 100644
--- a/src/Trash.Tests/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStepTest.cs
+++ b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStepTest.cs
@@ -2,12 +2,12 @@ using System.Collections.Generic;
using FluentAssertions;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
-using Trash.Radarr;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Processors.GuideSteps;
using Trash.TestLibrary;
+using TrashLib.Radarr;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Processors.GuideSteps;
-namespace Trash.Tests.Radarr.CustomFormat.Processors.GuideSteps
+namespace TrashLib.Tests.Radarr.CustomFormat.Processors.GuideSteps
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceProcessorTest.cs b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceProcessorTest.cs
similarity index 92%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceProcessorTest.cs
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceProcessorTest.cs
index 3331c75f..919fb1fb 100644
--- a/src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceProcessorTest.cs
+++ b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceProcessorTest.cs
@@ -4,14 +4,14 @@ using System.Collections.ObjectModel;
using Newtonsoft.Json.Linq;
using NSubstitute;
using NUnit.Framework;
-using Trash.Config;
-using Trash.Radarr;
-using Trash.Radarr.CustomFormat.Api;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
-using Trash.Radarr.CustomFormat.Processors;
-
-namespace Trash.Tests.Radarr.CustomFormat.Processors
+using TrashLib.Config;
+using TrashLib.Radarr;
+using TrashLib.Radarr.CustomFormat.Api;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Processors;
+
+namespace TrashLib.Tests.Radarr.CustomFormat.Processors
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStepTest.cs b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStepTest.cs
similarity index 85%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStepTest.cs
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStepTest.cs
index 73940349..e62061cc 100644
--- a/src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStepTest.cs
+++ b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStepTest.cs
@@ -3,12 +3,12 @@ using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using NSubstitute;
using NUnit.Framework;
-using Trash.Radarr.CustomFormat.Api;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
-using Trash.Radarr.CustomFormat.Processors.PersistenceSteps;
+using TrashLib.Radarr.CustomFormat.Api;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps;
-namespace Trash.Tests.Radarr.CustomFormat.Processors.PersistenceSteps
+namespace TrashLib.Tests.Radarr.CustomFormat.Processors.PersistenceSteps
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStepTest.cs b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStepTest.cs
similarity index 97%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStepTest.cs
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStepTest.cs
index 32904d48..e5d49208 100644
--- a/src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStepTest.cs
+++ b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStepTest.cs
@@ -5,9 +5,9 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NUnit.Framework;
using TestLibrary.FluentAssertions;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
-using Trash.Radarr.CustomFormat.Processors.PersistenceSteps;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps;
/* Sample Custom Format response from Radarr API
{
@@ -37,7 +37,7 @@ using Trash.Radarr.CustomFormat.Processors.PersistenceSteps;
}
*/
-namespace Trash.Tests.Radarr.CustomFormat.Processors.PersistenceSteps
+namespace TrashLib.Tests.Radarr.CustomFormat.Processors.PersistenceSteps
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStepTest.cs b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStepTest.cs
similarity index 96%
rename from src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStepTest.cs
rename to src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStepTest.cs
index 4e7fa162..11df5eb6 100644
--- a/src/Trash.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStepTest.cs
+++ b/src/TrashLib.Tests/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStepTest.cs
@@ -6,13 +6,13 @@ using Newtonsoft.Json.Linq;
using NSubstitute;
using NUnit.Framework;
using TestLibrary.NSubstitute;
-using Trash.Radarr.CustomFormat.Api;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
-using Trash.Radarr.CustomFormat.Processors.PersistenceSteps;
using Trash.TestLibrary;
+using TrashLib.Radarr.CustomFormat.Api;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps;
-namespace Trash.Tests.Radarr.CustomFormat.Processors.PersistenceSteps
+namespace TrashLib.Tests.Radarr.CustomFormat.Processors.PersistenceSteps
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/QualityDefinition/RadarrQualityDataTest.cs b/src/TrashLib.Tests/Radarr/QualityDefinition/RadarrQualityDataTest.cs
similarity index 97%
rename from src/Trash.Tests/Radarr/QualityDefinition/RadarrQualityDataTest.cs
rename to src/TrashLib.Tests/Radarr/QualityDefinition/RadarrQualityDataTest.cs
index 9c29f2ba..981ed978 100644
--- a/src/Trash.Tests/Radarr/QualityDefinition/RadarrQualityDataTest.cs
+++ b/src/TrashLib.Tests/Radarr/QualityDefinition/RadarrQualityDataTest.cs
@@ -1,8 +1,8 @@
using FluentAssertions;
using NUnit.Framework;
-using Trash.Radarr.QualityDefinition;
+using TrashLib.Radarr.QualityDefinition;
-namespace Trash.Tests.Radarr.QualityDefinition
+namespace TrashLib.Tests.Radarr.QualityDefinition
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Radarr/RadarrConfigurationTest.cs b/src/TrashLib.Tests/Radarr/RadarrConfigurationTest.cs
similarity index 97%
rename from src/Trash.Tests/Radarr/RadarrConfigurationTest.cs
rename to src/TrashLib.Tests/Radarr/RadarrConfigurationTest.cs
index 1e2669fd..cef53d12 100644
--- a/src/Trash.Tests/Radarr/RadarrConfigurationTest.cs
+++ b/src/TrashLib.Tests/Radarr/RadarrConfigurationTest.cs
@@ -6,11 +6,12 @@ using FluentAssertions;
using NSubstitute;
using NUnit.Framework;
using Trash.Config;
-using Trash.Radarr;
+using TrashLib.Config;
+using TrashLib.Radarr;
using YamlDotNet.Core;
using YamlDotNet.Serialization.ObjectFactories;
-namespace Trash.Tests.Radarr
+namespace TrashLib.Tests.Radarr
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Sonarr/QualityDefinition/SonarrQualityDataTest.cs b/src/TrashLib.Tests/Sonarr/QualityDefinition/SonarrQualityDataTest.cs
similarity index 97%
rename from src/Trash.Tests/Sonarr/QualityDefinition/SonarrQualityDataTest.cs
rename to src/TrashLib.Tests/Sonarr/QualityDefinition/SonarrQualityDataTest.cs
index 26e6989b..5fccfe92 100644
--- a/src/Trash.Tests/Sonarr/QualityDefinition/SonarrQualityDataTest.cs
+++ b/src/TrashLib.Tests/Sonarr/QualityDefinition/SonarrQualityDataTest.cs
@@ -1,8 +1,8 @@
using FluentAssertions;
using NUnit.Framework;
-using Trash.Sonarr.QualityDefinition;
+using TrashLib.Sonarr.QualityDefinition;
-namespace Trash.Tests.Sonarr.QualityDefinition
+namespace TrashLib.Tests.Sonarr.QualityDefinition
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Sonarr/ReleaseProfile/Data/include_preferred_when_renaming.md b/src/TrashLib.Tests/Sonarr/ReleaseProfile/Data/include_preferred_when_renaming.md
similarity index 100%
rename from src/Trash.Tests/Sonarr/ReleaseProfile/Data/include_preferred_when_renaming.md
rename to src/TrashLib.Tests/Sonarr/ReleaseProfile/Data/include_preferred_when_renaming.md
diff --git a/src/Trash.Tests/Sonarr/ReleaseProfile/Data/strict_negative_scores.md b/src/TrashLib.Tests/Sonarr/ReleaseProfile/Data/strict_negative_scores.md
similarity index 100%
rename from src/Trash.Tests/Sonarr/ReleaseProfile/Data/strict_negative_scores.md
rename to src/TrashLib.Tests/Sonarr/ReleaseProfile/Data/strict_negative_scores.md
diff --git a/src/Trash.Tests/Sonarr/ReleaseProfile/Data/test_parse_markdown_complete_doc.md b/src/TrashLib.Tests/Sonarr/ReleaseProfile/Data/test_parse_markdown_complete_doc.md
similarity index 100%
rename from src/Trash.Tests/Sonarr/ReleaseProfile/Data/test_parse_markdown_complete_doc.md
rename to src/TrashLib.Tests/Sonarr/ReleaseProfile/Data/test_parse_markdown_complete_doc.md
diff --git a/src/Trash.Tests/Sonarr/ReleaseProfile/FilteredProfileDataTest.cs b/src/TrashLib.Tests/Sonarr/ReleaseProfile/FilteredProfileDataTest.cs
similarity index 96%
rename from src/Trash.Tests/Sonarr/ReleaseProfile/FilteredProfileDataTest.cs
rename to src/TrashLib.Tests/Sonarr/ReleaseProfile/FilteredProfileDataTest.cs
index 593df6f2..efd58bb1 100644
--- a/src/Trash.Tests/Sonarr/ReleaseProfile/FilteredProfileDataTest.cs
+++ b/src/TrashLib.Tests/Sonarr/ReleaseProfile/FilteredProfileDataTest.cs
@@ -1,10 +1,10 @@
using System.Collections.Generic;
using FluentAssertions;
using NUnit.Framework;
-using Trash.Sonarr;
-using Trash.Sonarr.ReleaseProfile;
+using TrashLib.Sonarr;
+using TrashLib.Sonarr.ReleaseProfile;
-namespace Trash.Tests.Sonarr.ReleaseProfile
+namespace TrashLib.Tests.Sonarr.ReleaseProfile
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Sonarr/ReleaseProfile/ReleaseProfileParserTest.cs b/src/TrashLib.Tests/Sonarr/ReleaseProfile/ReleaseProfileParserTest.cs
similarity index 99%
rename from src/Trash.Tests/Sonarr/ReleaseProfile/ReleaseProfileParserTest.cs
rename to src/TrashLib.Tests/Sonarr/ReleaseProfile/ReleaseProfileParserTest.cs
index b451bbba..4a27ef0b 100644
--- a/src/Trash.Tests/Sonarr/ReleaseProfile/ReleaseProfileParserTest.cs
+++ b/src/TrashLib.Tests/Sonarr/ReleaseProfile/ReleaseProfileParserTest.cs
@@ -6,10 +6,10 @@ using NUnit.Framework;
using Serilog;
using Serilog.Sinks.TestCorrelator;
using TestLibrary;
-using Trash.Sonarr;
-using Trash.Sonarr.ReleaseProfile;
+using TrashLib.Sonarr;
+using TrashLib.Sonarr.ReleaseProfile;
-namespace Trash.Tests.Sonarr.ReleaseProfile
+namespace TrashLib.Tests.Sonarr.ReleaseProfile
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Sonarr/ReleaseProfile/ScopedStateTest.cs b/src/TrashLib.Tests/Sonarr/ReleaseProfile/ScopedStateTest.cs
similarity index 97%
rename from src/Trash.Tests/Sonarr/ReleaseProfile/ScopedStateTest.cs
rename to src/TrashLib.Tests/Sonarr/ReleaseProfile/ScopedStateTest.cs
index faeddee1..775b5c2d 100644
--- a/src/Trash.Tests/Sonarr/ReleaseProfile/ScopedStateTest.cs
+++ b/src/TrashLib.Tests/Sonarr/ReleaseProfile/ScopedStateTest.cs
@@ -1,8 +1,8 @@
using FluentAssertions;
using NUnit.Framework;
-using Trash.Sonarr.ReleaseProfile;
+using TrashLib.Sonarr.ReleaseProfile;
-namespace Trash.Tests.Sonarr.ReleaseProfile
+namespace TrashLib.Tests.Sonarr.ReleaseProfile
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/Trash.Tests/Sonarr/ReleaseProfileUpdaterTest.cs b/src/TrashLib.Tests/Sonarr/ReleaseProfileUpdaterTest.cs
similarity index 82%
rename from src/Trash.Tests/Sonarr/ReleaseProfileUpdaterTest.cs
rename to src/TrashLib.Tests/Sonarr/ReleaseProfileUpdaterTest.cs
index 7ecb9563..c4ed4126 100644
--- a/src/Trash.Tests/Sonarr/ReleaseProfileUpdaterTest.cs
+++ b/src/TrashLib.Tests/Sonarr/ReleaseProfileUpdaterTest.cs
@@ -1,11 +1,11 @@
using NSubstitute;
using NUnit.Framework;
using Serilog;
-using Trash.Sonarr;
-using Trash.Sonarr.Api;
-using Trash.Sonarr.ReleaseProfile;
+using TrashLib.Sonarr;
+using TrashLib.Sonarr.Api;
+using TrashLib.Sonarr.ReleaseProfile;
-namespace Trash.Tests.Sonarr
+namespace TrashLib.Tests.Sonarr
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
@@ -13,7 +13,6 @@ namespace Trash.Tests.Sonarr
{
private class Context
{
- public ISonarrCommand Args { get; } = Substitute.For();
public IReleaseProfileGuideParser Parser { get; } = Substitute.For();
public ISonarrApi Api { get; } = Substitute.For();
public ILogger Logger { get; } = Substitute.For();
@@ -25,7 +24,7 @@ namespace Trash.Tests.Sonarr
var context = new Context();
var logic = new ReleaseProfileUpdater(context.Logger, context.Parser, context.Api);
- logic.Process(context.Args, new SonarrConfiguration());
+ logic.Process(false, new SonarrConfiguration());
context.Parser.DidNotReceive().GetMarkdownData(Arg.Any());
}
@@ -42,7 +41,7 @@ namespace Trash.Tests.Sonarr
};
var logic = new ReleaseProfileUpdater(context.Logger, context.Parser, context.Api);
- logic.Process(context.Args, config);
+ logic.Process(false, config);
context.Parser.Received().ParseMarkdown(config.ReleaseProfiles[0], "theMarkdown");
}
diff --git a/src/Trash.Tests/Sonarr/SonarrConfigurationTest.cs b/src/TrashLib.Tests/Sonarr/SonarrConfigurationTest.cs
similarity index 92%
rename from src/Trash.Tests/Sonarr/SonarrConfigurationTest.cs
rename to src/TrashLib.Tests/Sonarr/SonarrConfigurationTest.cs
index 95ada17c..c4a84ecf 100644
--- a/src/Trash.Tests/Sonarr/SonarrConfigurationTest.cs
+++ b/src/TrashLib.Tests/Sonarr/SonarrConfigurationTest.cs
@@ -5,11 +5,12 @@ using FluentAssertions;
using NSubstitute;
using NUnit.Framework;
using Trash.Config;
-using Trash.Sonarr;
+using TrashLib.Config;
+using TrashLib.Sonarr;
using YamlDotNet.Core;
using YamlDotNet.Serialization.ObjectFactories;
-namespace Trash.Tests.Sonarr
+namespace TrashLib.Tests.Sonarr
{
[TestFixture]
[Parallelizable(ParallelScope.All)]
diff --git a/src/TrashLib.Tests/TrashLib.Tests.csproj b/src/TrashLib.Tests/TrashLib.Tests.csproj
new file mode 100644
index 00000000..9f984b62
--- /dev/null
+++ b/src/TrashLib.Tests/TrashLib.Tests.csproj
@@ -0,0 +1,11 @@
+
+
+ false
+
+
+
+
+
+
+
+
diff --git a/src/TrashLib/Cache/CacheAutofacModule.cs b/src/TrashLib/Cache/CacheAutofacModule.cs
new file mode 100644
index 00000000..a1e7be28
--- /dev/null
+++ b/src/TrashLib/Cache/CacheAutofacModule.cs
@@ -0,0 +1,13 @@
+using Autofac;
+
+namespace TrashLib.Cache
+{
+ public class CacheAutofacModule : Module
+ {
+ protected override void Load(ContainerBuilder builder)
+ {
+ // Clients must register their own implementation of ICacheStoragePath
+ builder.RegisterType().As();
+ }
+ }
+}
diff --git a/src/Trash/Cache/CacheObjectNameAttribute.cs b/src/TrashLib/Cache/CacheObjectNameAttribute.cs
similarity index 70%
rename from src/Trash/Cache/CacheObjectNameAttribute.cs
rename to src/TrashLib/Cache/CacheObjectNameAttribute.cs
index 7095ef26..7d8d9b03 100644
--- a/src/Trash/Cache/CacheObjectNameAttribute.cs
+++ b/src/TrashLib/Cache/CacheObjectNameAttribute.cs
@@ -1,9 +1,9 @@
using System;
-namespace Trash.Cache
+namespace TrashLib.Cache
{
[AttributeUsage(AttributeTargets.Class)]
- public sealed class CacheObjectNameAttribute : Attribute
+ internal sealed class CacheObjectNameAttribute : Attribute
{
public CacheObjectNameAttribute(string name)
{
diff --git a/src/Trash/Cache/ICacheStoragePath.cs b/src/TrashLib/Cache/ICacheStoragePath.cs
similarity index 75%
rename from src/Trash/Cache/ICacheStoragePath.cs
rename to src/TrashLib/Cache/ICacheStoragePath.cs
index 557f3fc0..56d077b2 100644
--- a/src/Trash/Cache/ICacheStoragePath.cs
+++ b/src/TrashLib/Cache/ICacheStoragePath.cs
@@ -1,4 +1,4 @@
-namespace Trash.Cache
+namespace TrashLib.Cache
{
public interface ICacheStoragePath
{
diff --git a/src/Trash/Cache/IServiceCache.cs b/src/TrashLib/Cache/IServiceCache.cs
similarity index 82%
rename from src/Trash/Cache/IServiceCache.cs
rename to src/TrashLib/Cache/IServiceCache.cs
index ee174b81..fcca0f83 100644
--- a/src/Trash/Cache/IServiceCache.cs
+++ b/src/TrashLib/Cache/IServiceCache.cs
@@ -1,4 +1,4 @@
-namespace Trash.Cache
+namespace TrashLib.Cache
{
public interface IServiceCache
{
diff --git a/src/Trash/Cache/ServiceCache.cs b/src/TrashLib/Cache/ServiceCache.cs
similarity index 97%
rename from src/Trash/Cache/ServiceCache.cs
rename to src/TrashLib/Cache/ServiceCache.cs
index 3749f0dd..1c6b9718 100644
--- a/src/Trash/Cache/ServiceCache.cs
+++ b/src/TrashLib/Cache/ServiceCache.cs
@@ -9,11 +9,11 @@ using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using Serilog;
-using Trash.Config;
+using TrashLib.Config;
-namespace Trash.Cache
+namespace TrashLib.Cache
{
- public class ServiceCache : IServiceCache
+ internal class ServiceCache : IServiceCache
{
private static readonly Regex AllowedObjectNameCharacters = new(@"^[\w-]+$", RegexOptions.Compiled);
private readonly IConfigurationProvider _configProvider;
diff --git a/src/TrashLib/Config/ConfigAutofacModule.cs b/src/TrashLib/Config/ConfigAutofacModule.cs
new file mode 100644
index 00000000..deadcaf4
--- /dev/null
+++ b/src/TrashLib/Config/ConfigAutofacModule.cs
@@ -0,0 +1,14 @@
+using Autofac;
+
+namespace TrashLib.Config
+{
+ public class ConfigAutofacModule : Module
+ {
+ protected override void Load(ContainerBuilder builder)
+ {
+ builder.RegisterType()
+ .As()
+ .SingleInstance();
+ }
+ }
+}
diff --git a/src/Trash/Config/ConfigurationProvider.cs b/src/TrashLib/Config/ConfigurationProvider.cs
similarity index 93%
rename from src/Trash/Config/ConfigurationProvider.cs
rename to src/TrashLib/Config/ConfigurationProvider.cs
index 99f07e9e..ff6d7cec 100644
--- a/src/Trash/Config/ConfigurationProvider.cs
+++ b/src/TrashLib/Config/ConfigurationProvider.cs
@@ -1,6 +1,6 @@
using System;
-namespace Trash.Config
+namespace TrashLib.Config
{
internal class ConfigurationProvider : IConfigurationProvider
{
diff --git a/src/Trash/Config/IConfigurationProvider.cs b/src/TrashLib/Config/IConfigurationProvider.cs
similarity index 81%
rename from src/Trash/Config/IConfigurationProvider.cs
rename to src/TrashLib/Config/IConfigurationProvider.cs
index 94cf6181..a3668c94 100644
--- a/src/Trash/Config/IConfigurationProvider.cs
+++ b/src/TrashLib/Config/IConfigurationProvider.cs
@@ -1,4 +1,4 @@
-namespace Trash.Config
+namespace TrashLib.Config
{
public interface IConfigurationProvider
{
diff --git a/src/Trash/Config/IServiceConfiguration.cs b/src/TrashLib/Config/IServiceConfiguration.cs
similarity index 86%
rename from src/Trash/Config/IServiceConfiguration.cs
rename to src/TrashLib/Config/IServiceConfiguration.cs
index cd9325d4..b6599e00 100644
--- a/src/Trash/Config/IServiceConfiguration.cs
+++ b/src/TrashLib/Config/IServiceConfiguration.cs
@@ -1,4 +1,4 @@
-namespace Trash.Config
+namespace TrashLib.Config
{
public interface IServiceConfiguration
{
diff --git a/src/Trash/Config/ServiceConfiguration.cs b/src/TrashLib/Config/ServiceConfiguration.cs
similarity index 94%
rename from src/Trash/Config/ServiceConfiguration.cs
rename to src/TrashLib/Config/ServiceConfiguration.cs
index 5410a7be..881fcd9b 100644
--- a/src/Trash/Config/ServiceConfiguration.cs
+++ b/src/TrashLib/Config/ServiceConfiguration.cs
@@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations;
-namespace Trash.Config
+namespace TrashLib.Config
{
public abstract class ServiceConfiguration : IServiceConfiguration
{
diff --git a/src/TrashLib/ExceptionTypes/VersionException.cs b/src/TrashLib/ExceptionTypes/VersionException.cs
new file mode 100644
index 00000000..0f0409af
--- /dev/null
+++ b/src/TrashLib/ExceptionTypes/VersionException.cs
@@ -0,0 +1,12 @@
+using System;
+
+namespace TrashLib.ExceptionTypes
+{
+ public class VersionException : Exception
+ {
+ public VersionException(string msg)
+ : base(msg)
+ {
+ }
+ }
+}
diff --git a/src/Trash/Config/IServerInfo.cs b/src/TrashLib/IServerInfo.cs
similarity index 76%
rename from src/Trash/Config/IServerInfo.cs
rename to src/TrashLib/IServerInfo.cs
index 530cc77a..ee77e831 100644
--- a/src/Trash/Config/IServerInfo.cs
+++ b/src/TrashLib/IServerInfo.cs
@@ -1,4 +1,4 @@
-namespace Trash.Config
+namespace TrashLib
{
public interface IServerInfo
{
diff --git a/src/Trash/Radarr/CustomFormat/Api/CustomFormatService.cs b/src/TrashLib/Radarr/CustomFormat/Api/CustomFormatService.cs
similarity index 93%
rename from src/Trash/Radarr/CustomFormat/Api/CustomFormatService.cs
rename to src/TrashLib/Radarr/CustomFormat/Api/CustomFormatService.cs
index dc922f60..8677514c 100644
--- a/src/Trash/Radarr/CustomFormat/Api/CustomFormatService.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Api/CustomFormatService.cs
@@ -3,10 +3,9 @@ using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
using Newtonsoft.Json.Linq;
-using Trash.Config;
-using Trash.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models;
-namespace Trash.Radarr.CustomFormat.Api
+namespace TrashLib.Radarr.CustomFormat.Api
{
internal class CustomFormatService : ICustomFormatService
{
diff --git a/src/Trash/Radarr/CustomFormat/Api/ICustomFormatService.cs b/src/TrashLib/Radarr/CustomFormat/Api/ICustomFormatService.cs
similarity index 81%
rename from src/Trash/Radarr/CustomFormat/Api/ICustomFormatService.cs
rename to src/TrashLib/Radarr/CustomFormat/Api/ICustomFormatService.cs
index 626f7505..9c8a64c4 100644
--- a/src/Trash/Radarr/CustomFormat/Api/ICustomFormatService.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Api/ICustomFormatService.cs
@@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
-using Trash.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models;
-namespace Trash.Radarr.CustomFormat.Api
+namespace TrashLib.Radarr.CustomFormat.Api
{
public interface ICustomFormatService
{
diff --git a/src/Trash/Radarr/CustomFormat/Api/IQualityProfileService.cs b/src/TrashLib/Radarr/CustomFormat/Api/IQualityProfileService.cs
similarity index 86%
rename from src/Trash/Radarr/CustomFormat/Api/IQualityProfileService.cs
rename to src/TrashLib/Radarr/CustomFormat/Api/IQualityProfileService.cs
index 320c65e1..f1ba6442 100644
--- a/src/Trash/Radarr/CustomFormat/Api/IQualityProfileService.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Api/IQualityProfileService.cs
@@ -2,7 +2,7 @@
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
-namespace Trash.Radarr.CustomFormat.Api
+namespace TrashLib.Radarr.CustomFormat.Api
{
public interface IQualityProfileService
{
diff --git a/src/Trash/Radarr/CustomFormat/Api/QualityProfileService.cs b/src/TrashLib/Radarr/CustomFormat/Api/QualityProfileService.cs
similarity index 93%
rename from src/Trash/Radarr/CustomFormat/Api/QualityProfileService.cs
rename to src/TrashLib/Radarr/CustomFormat/Api/QualityProfileService.cs
index 1fa23737..c5a35803 100644
--- a/src/Trash/Radarr/CustomFormat/Api/QualityProfileService.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Api/QualityProfileService.cs
@@ -3,9 +3,8 @@ using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
using Newtonsoft.Json.Linq;
-using Trash.Config;
-namespace Trash.Radarr.CustomFormat.Api
+namespace TrashLib.Radarr.CustomFormat.Api
{
internal class QualityProfileService : IQualityProfileService
{
diff --git a/src/Trash/Radarr/CustomFormat/ApiOperationType.cs b/src/TrashLib/Radarr/CustomFormat/ApiOperationType.cs
similarity index 74%
rename from src/Trash/Radarr/CustomFormat/ApiOperationType.cs
rename to src/TrashLib/Radarr/CustomFormat/ApiOperationType.cs
index 79ffbb0b..6b920792 100644
--- a/src/Trash/Radarr/CustomFormat/ApiOperationType.cs
+++ b/src/TrashLib/Radarr/CustomFormat/ApiOperationType.cs
@@ -1,4 +1,4 @@
-namespace Trash.Radarr.CustomFormat
+namespace TrashLib.Radarr.CustomFormat
{
public enum ApiOperationType
{
diff --git a/src/Trash/Radarr/CustomFormat/CachePersister.cs b/src/TrashLib/Radarr/CustomFormat/CachePersister.cs
similarity index 90%
rename from src/Trash/Radarr/CustomFormat/CachePersister.cs
rename to src/TrashLib/Radarr/CustomFormat/CachePersister.cs
index 53df22e4..9246cecb 100644
--- a/src/Trash/Radarr/CustomFormat/CachePersister.cs
+++ b/src/TrashLib/Radarr/CustomFormat/CachePersister.cs
@@ -1,13 +1,13 @@
using System.Collections.Generic;
using System.Linq;
using Serilog;
-using Trash.Cache;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Cache;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
-namespace Trash.Radarr.CustomFormat
+namespace TrashLib.Radarr.CustomFormat
{
- public class CachePersister : ICachePersister
+ internal class CachePersister : ICachePersister
{
private readonly IServiceCache _cache;
diff --git a/src/Trash/Radarr/CustomFormat/CustomFormatUpdater.cs b/src/TrashLib/Radarr/CustomFormat/CustomFormatUpdater.cs
similarity index 92%
rename from src/Trash/Radarr/CustomFormat/CustomFormatUpdater.cs
rename to src/TrashLib/Radarr/CustomFormat/CustomFormatUpdater.cs
index 318abf1e..253dffa8 100644
--- a/src/Trash/Radarr/CustomFormat/CustomFormatUpdater.cs
+++ b/src/TrashLib/Radarr/CustomFormat/CustomFormatUpdater.cs
@@ -1,13 +1,12 @@
using System;
using System.Linq;
using System.Threading.Tasks;
+using Common.Extensions;
using Serilog;
-using Trash.Command;
-using Trash.Extensions;
-using Trash.Radarr.CustomFormat.Processors;
-using Trash.Radarr.CustomFormat.Processors.PersistenceSteps;
+using TrashLib.Radarr.CustomFormat.Processors;
+using TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps;
-namespace Trash.Radarr.CustomFormat
+namespace TrashLib.Radarr.CustomFormat
{
internal class CustomFormatUpdater : ICustomFormatUpdater
{
@@ -29,7 +28,7 @@ namespace Trash.Radarr.CustomFormat
private ILogger Log { get; }
- public async Task Process(IServiceCommand args, RadarrConfiguration config)
+ public async Task Process(bool isPreview, RadarrConfiguration config)
{
_cache.Load();
@@ -40,7 +39,7 @@ namespace Trash.Radarr.CustomFormat
return;
}
- if (args.Preview)
+ if (isPreview)
{
PreviewCustomFormats();
}
@@ -49,7 +48,7 @@ namespace Trash.Radarr.CustomFormat
await _persistenceProcessor.PersistCustomFormats(_guideProcessor.ProcessedCustomFormats,
_guideProcessor.DeletedCustomFormatsInCache, _guideProcessor.ProfileScores);
- PrintApiStatistics(args, _persistenceProcessor.Transactions);
+ PrintApiStatistics(_persistenceProcessor.Transactions);
PrintQualityProfileUpdates();
// Cache all the custom formats (using ID from API response).
@@ -92,7 +91,7 @@ namespace Trash.Radarr.CustomFormat
}
}
- private void PrintApiStatistics(IServiceCommand args, CustomFormatTransactionData transactions)
+ private void PrintApiStatistics(CustomFormatTransactionData transactions)
{
var created = transactions.NewCustomFormats;
if (created.Count > 0)
@@ -108,14 +107,11 @@ namespace Trash.Radarr.CustomFormat
updated.Select(r => r.Name));
}
- if (args.Debug)
+ var skipped = transactions.UnchangedCustomFormats;
+ if (skipped.Count > 0)
{
- var skipped = transactions.UnchangedCustomFormats;
- if (skipped.Count > 0)
- {
- Log.Debug("Skipped {Count} Custom Formats that did not change: {CustomFormats}", skipped.Count,
- skipped.Select(r => r.Name));
- }
+ Log.Debug("Skipped {Count} Custom Formats that did not change: {CustomFormats}", skipped.Count,
+ skipped.Select(r => r.Name));
}
var deleted = transactions.DeletedCustomFormatIds;
diff --git a/src/Trash/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequester.cs b/src/TrashLib/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequester.cs
similarity index 94%
rename from src/Trash/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequester.cs
rename to src/TrashLib/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequester.cs
index 2e9e17ad..e2c66ef9 100644
--- a/src/Trash/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequester.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Guide/GithubCustomFormatJsonRequester.cs
@@ -7,9 +7,9 @@ using JetBrains.Annotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
-namespace Trash.Radarr.CustomFormat.Guide
+namespace TrashLib.Radarr.CustomFormat.Guide
{
- public class GithubCustomFormatJsonRequester : IRadarrGuideService
+ internal class GithubCustomFormatJsonRequester : IRadarrGuideService
{
private readonly ISerializer _flurlSerializer;
diff --git a/src/Trash/Radarr/CustomFormat/Guide/IRadarrGuideService.cs b/src/TrashLib/Radarr/CustomFormat/Guide/IRadarrGuideService.cs
similarity index 79%
rename from src/Trash/Radarr/CustomFormat/Guide/IRadarrGuideService.cs
rename to src/TrashLib/Radarr/CustomFormat/Guide/IRadarrGuideService.cs
index 02d305b0..f9be9b12 100644
--- a/src/Trash/Radarr/CustomFormat/Guide/IRadarrGuideService.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Guide/IRadarrGuideService.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-namespace Trash.Radarr.CustomFormat.Guide
+namespace TrashLib.Radarr.CustomFormat.Guide
{
public interface IRadarrGuideService
{
diff --git a/src/Trash/Radarr/CustomFormat/ICachePersister.cs b/src/TrashLib/Radarr/CustomFormat/ICachePersister.cs
similarity index 65%
rename from src/Trash/Radarr/CustomFormat/ICachePersister.cs
rename to src/TrashLib/Radarr/CustomFormat/ICachePersister.cs
index 896bff68..bb6ecdf9 100644
--- a/src/Trash/Radarr/CustomFormat/ICachePersister.cs
+++ b/src/TrashLib/Radarr/CustomFormat/ICachePersister.cs
@@ -1,8 +1,8 @@
using System.Collections.Generic;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
-namespace Trash.Radarr.CustomFormat
+namespace TrashLib.Radarr.CustomFormat
{
public interface ICachePersister
{
diff --git a/src/TrashLib/Radarr/CustomFormat/ICustomFormatUpdater.cs b/src/TrashLib/Radarr/CustomFormat/ICustomFormatUpdater.cs
new file mode 100644
index 00000000..06e935b5
--- /dev/null
+++ b/src/TrashLib/Radarr/CustomFormat/ICustomFormatUpdater.cs
@@ -0,0 +1,9 @@
+using System.Threading.Tasks;
+
+namespace TrashLib.Radarr.CustomFormat
+{
+ public interface ICustomFormatUpdater
+ {
+ Task Process(bool isPreview, RadarrConfiguration config);
+ }
+}
diff --git a/src/Trash/Radarr/CustomFormat/Models/Cache/CustomFormatCache.cs b/src/TrashLib/Radarr/CustomFormat/Models/Cache/CustomFormatCache.cs
similarity index 90%
rename from src/Trash/Radarr/CustomFormat/Models/Cache/CustomFormatCache.cs
rename to src/TrashLib/Radarr/CustomFormat/Models/Cache/CustomFormatCache.cs
index 9ac3ae46..990715d4 100644
--- a/src/Trash/Radarr/CustomFormat/Models/Cache/CustomFormatCache.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Models/Cache/CustomFormatCache.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
-using Trash.Cache;
+using TrashLib.Cache;
-namespace Trash.Radarr.CustomFormat.Models.Cache
+namespace TrashLib.Radarr.CustomFormat.Models.Cache
{
[CacheObjectName("custom-format-cache")]
public class CustomFormatCache
diff --git a/src/Trash/Radarr/CustomFormat/Models/ProcessedConfigData.cs b/src/TrashLib/Radarr/CustomFormat/Models/ProcessedConfigData.cs
similarity index 84%
rename from src/Trash/Radarr/CustomFormat/Models/ProcessedConfigData.cs
rename to src/TrashLib/Radarr/CustomFormat/Models/ProcessedConfigData.cs
index 923114bd..3e0ac62d 100644
--- a/src/Trash/Radarr/CustomFormat/Models/ProcessedConfigData.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Models/ProcessedConfigData.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Trash.Radarr.CustomFormat.Models
+namespace TrashLib.Radarr.CustomFormat.Models
{
public class ProcessedConfigData
{
diff --git a/src/Trash/Radarr/CustomFormat/Models/ProcessedCustomFormatData.cs b/src/TrashLib/Radarr/CustomFormat/Models/ProcessedCustomFormatData.cs
similarity index 92%
rename from src/Trash/Radarr/CustomFormat/Models/ProcessedCustomFormatData.cs
rename to src/TrashLib/Radarr/CustomFormat/Models/ProcessedCustomFormatData.cs
index 436aa4cc..564788f8 100644
--- a/src/Trash/Radarr/CustomFormat/Models/ProcessedCustomFormatData.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Models/ProcessedCustomFormatData.cs
@@ -1,9 +1,9 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json.Linq;
-using Trash.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
-namespace Trash.Radarr.CustomFormat.Models
+namespace TrashLib.Radarr.CustomFormat.Models
{
public class ProcessedCustomFormatData
{
diff --git a/src/Trash/Radarr/CustomFormat/Models/QualityProfileCustomFormatScoreMapping.cs b/src/TrashLib/Radarr/CustomFormat/Models/QualityProfileCustomFormatScoreMapping.cs
similarity index 91%
rename from src/Trash/Radarr/CustomFormat/Models/QualityProfileCustomFormatScoreMapping.cs
rename to src/TrashLib/Radarr/CustomFormat/Models/QualityProfileCustomFormatScoreMapping.cs
index 08c0f869..835e4dfc 100644
--- a/src/Trash/Radarr/CustomFormat/Models/QualityProfileCustomFormatScoreMapping.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Models/QualityProfileCustomFormatScoreMapping.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Trash.Radarr.CustomFormat.Models
+namespace TrashLib.Radarr.CustomFormat.Models
{
public record FormatMappingEntry(ProcessedCustomFormatData CustomFormat, int Score);
diff --git a/src/Trash/Radarr/CustomFormat/Models/UpdatedFormatScore.cs b/src/TrashLib/Radarr/CustomFormat/Models/UpdatedFormatScore.cs
similarity index 82%
rename from src/Trash/Radarr/CustomFormat/Models/UpdatedFormatScore.cs
rename to src/TrashLib/Radarr/CustomFormat/Models/UpdatedFormatScore.cs
index 9e850584..50b51f98 100644
--- a/src/Trash/Radarr/CustomFormat/Models/UpdatedFormatScore.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Models/UpdatedFormatScore.cs
@@ -1,4 +1,4 @@
-namespace Trash.Radarr.CustomFormat.Models
+namespace TrashLib.Radarr.CustomFormat.Models
{
public enum FormatScoreUpdateReason
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/GuideProcessor.cs b/src/TrashLib/Radarr/CustomFormat/Processors/GuideProcessor.cs
similarity index 93%
rename from src/Trash/Radarr/CustomFormat/Processors/GuideProcessor.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/GuideProcessor.cs
index 16046f0f..f3471273 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/GuideProcessor.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/GuideProcessor.cs
@@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Serilog;
-using Trash.Radarr.CustomFormat.Guide;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
-using Trash.Radarr.CustomFormat.Processors.GuideSteps;
+using TrashLib.Radarr.CustomFormat.Guide;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Processors.GuideSteps;
-namespace Trash.Radarr.CustomFormat.Processors
+namespace TrashLib.Radarr.CustomFormat.Processors
{
public interface IGuideProcessorSteps
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/ConfigStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/ConfigStep.cs
similarity index 92%
rename from src/Trash/Radarr/CustomFormat/Processors/GuideSteps/ConfigStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/ConfigStep.cs
index 388f69aa..a67d39c0 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/ConfigStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/ConfigStep.cs
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Common.Extensions;
using MoreLinq.Extensions;
-using Trash.Extensions;
-using Trash.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models;
-namespace Trash.Radarr.CustomFormat.Processors.GuideSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.GuideSteps
{
- public class ConfigStep : IConfigStep
+ internal class ConfigStep : IConfigStep
{
public List CustomFormatsNotInGuide { get; } = new();
public List ConfigData { get; } = new();
diff --git a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStep.cs
similarity index 96%
rename from src/Trash/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStep.cs
index 2106d1be..fac591fb 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/CustomFormatStep.cs
@@ -1,14 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Common.Extensions;
using Newtonsoft.Json.Linq;
-using Trash.Extensions;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
-namespace Trash.Radarr.CustomFormat.Processors.GuideSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.GuideSteps
{
- public class CustomFormatStep : ICustomFormatStep
+ internal class CustomFormatStep : ICustomFormatStep
{
public List<(string, string)> CustomFormatsWithOutdatedNames { get; } = new();
public List ProcessedCustomFormats { get; } = new();
diff --git a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/IConfigStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/IConfigStep.cs
similarity index 75%
rename from src/Trash/Radarr/CustomFormat/Processors/GuideSteps/IConfigStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/IConfigStep.cs
index 95e29bc9..dc4d57d9 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/IConfigStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/IConfigStep.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
-using Trash.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models;
-namespace Trash.Radarr.CustomFormat.Processors.GuideSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.GuideSteps
{
public interface IConfigStep
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/ICustomFormatStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/ICustomFormatStep.cs
similarity index 78%
rename from src/Trash/Radarr/CustomFormat/Processors/GuideSteps/ICustomFormatStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/ICustomFormatStep.cs
index e3dcacb7..c9b07e55 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/ICustomFormatStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/ICustomFormatStep.cs
@@ -1,8 +1,8 @@
using System.Collections.Generic;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
-namespace Trash.Radarr.CustomFormat.Processors.GuideSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.GuideSteps
{
public interface ICustomFormatStep
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/IQualityProfileStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/IQualityProfileStep.cs
similarity index 76%
rename from src/Trash/Radarr/CustomFormat/Processors/GuideSteps/IQualityProfileStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/IQualityProfileStep.cs
index c9a25120..9ee8de5f 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/IQualityProfileStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/IQualityProfileStep.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
-using Trash.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models;
-namespace Trash.Radarr.CustomFormat.Processors.GuideSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.GuideSteps
{
public interface IQualityProfileStep
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStep.cs
similarity index 91%
rename from src/Trash/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStep.cs
index 81a9cc57..d2d975d9 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/GuideSteps/QualityProfileStep.cs
@@ -1,9 +1,9 @@
using System.Collections.Generic;
-using Trash.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models;
-namespace Trash.Radarr.CustomFormat.Processors.GuideSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.GuideSteps
{
- public class QualityProfileStep : IQualityProfileStep
+ internal class QualityProfileStep : IQualityProfileStep
{
public Dictionary ProfileScores { get; } = new();
public List<(string name, string trashId, string profileName)> CustomFormatsWithoutScore { get; } = new();
diff --git a/src/Trash/Radarr/CustomFormat/Processors/IGuideProcessor.cs b/src/TrashLib/Radarr/CustomFormat/Processors/IGuideProcessor.cs
similarity index 86%
rename from src/Trash/Radarr/CustomFormat/Processors/IGuideProcessor.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/IGuideProcessor.cs
index 9c2ddf72..1656c7b2 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/IGuideProcessor.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/IGuideProcessor.cs
@@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
-namespace Trash.Radarr.CustomFormat.Processors
+namespace TrashLib.Radarr.CustomFormat.Processors
{
internal interface IGuideProcessor
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/IPersistenceProcessor.cs b/src/TrashLib/Radarr/CustomFormat/Processors/IPersistenceProcessor.cs
similarity index 73%
rename from src/Trash/Radarr/CustomFormat/Processors/IPersistenceProcessor.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/IPersistenceProcessor.cs
index ef0abcb3..34721b40 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/IPersistenceProcessor.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/IPersistenceProcessor.cs
@@ -1,10 +1,10 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
-using Trash.Radarr.CustomFormat.Processors.PersistenceSteps;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps;
-namespace Trash.Radarr.CustomFormat.Processors
+namespace TrashLib.Radarr.CustomFormat.Processors
{
public interface IPersistenceProcessor
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/PersistenceProcessor.cs b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceProcessor.cs
similarity index 92%
rename from src/Trash/Radarr/CustomFormat/Processors/PersistenceProcessor.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/PersistenceProcessor.cs
index caea4441..67714565 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/PersistenceProcessor.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceProcessor.cs
@@ -1,13 +1,13 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
-using Trash.Config;
-using Trash.Radarr.CustomFormat.Api;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
-using Trash.Radarr.CustomFormat.Processors.PersistenceSteps;
+using TrashLib.Config;
+using TrashLib.Radarr.CustomFormat.Api;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps;
-namespace Trash.Radarr.CustomFormat.Processors
+namespace TrashLib.Radarr.CustomFormat.Processors
{
public interface IPersistenceProcessorSteps
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStep.cs
similarity index 76%
rename from src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStep.cs
index 92252cea..49ec80be 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/CustomFormatApiPersistenceStep.cs
@@ -1,9 +1,9 @@
using System.Threading.Tasks;
-using Trash.Radarr.CustomFormat.Api;
+using TrashLib.Radarr.CustomFormat.Api;
-namespace Trash.Radarr.CustomFormat.Processors.PersistenceSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps
{
- public class CustomFormatApiPersistenceStep : ICustomFormatApiPersistenceStep
+ internal class CustomFormatApiPersistenceStep : ICustomFormatApiPersistenceStep
{
public async Task Process(ICustomFormatService api, CustomFormatTransactionData transactions)
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/ICustomFormatApiPersistenceStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/ICustomFormatApiPersistenceStep.cs
similarity index 63%
rename from src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/ICustomFormatApiPersistenceStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/ICustomFormatApiPersistenceStep.cs
index 79277c95..d2d01eae 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/ICustomFormatApiPersistenceStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/ICustomFormatApiPersistenceStep.cs
@@ -1,7 +1,7 @@
using System.Threading.Tasks;
-using Trash.Radarr.CustomFormat.Api;
+using TrashLib.Radarr.CustomFormat.Api;
-namespace Trash.Radarr.CustomFormat.Processors.PersistenceSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps
{
public interface ICustomFormatApiPersistenceStep
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/IJsonTransactionStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/IJsonTransactionStep.cs
similarity index 71%
rename from src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/IJsonTransactionStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/IJsonTransactionStep.cs
index 7cd459b1..edbb0e16 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/IJsonTransactionStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/IJsonTransactionStep.cs
@@ -1,9 +1,9 @@
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
-namespace Trash.Radarr.CustomFormat.Processors.PersistenceSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps
{
public interface IJsonTransactionStep
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/IQualityProfileApiPersistenceStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/IQualityProfileApiPersistenceStep.cs
similarity index 73%
rename from src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/IQualityProfileApiPersistenceStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/IQualityProfileApiPersistenceStep.cs
index 0961fb0c..a4bd0c75 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/IQualityProfileApiPersistenceStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/IQualityProfileApiPersistenceStep.cs
@@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-using Trash.Radarr.CustomFormat.Api;
-using Trash.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Api;
+using TrashLib.Radarr.CustomFormat.Models;
-namespace Trash.Radarr.CustomFormat.Processors.PersistenceSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps
{
public interface IQualityProfileApiPersistenceStep
{
diff --git a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStep.cs
similarity index 96%
rename from src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStep.cs
index e4ab8e43..918e21b1 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/JsonTransactionStep.cs
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using System.Linq;
+using Common.Extensions;
using Newtonsoft.Json.Linq;
-using Trash.Extensions;
-using Trash.Radarr.CustomFormat.Models;
-using Trash.Radarr.CustomFormat.Models.Cache;
+using TrashLib.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Models.Cache;
-namespace Trash.Radarr.CustomFormat.Processors.PersistenceSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps
{
public class CustomFormatTransactionData
{
@@ -15,7 +15,7 @@ namespace Trash.Radarr.CustomFormat.Processors.PersistenceSteps
public List UnchangedCustomFormats { get; } = new();
}
- public class JsonTransactionStep : IJsonTransactionStep
+ internal class JsonTransactionStep : IJsonTransactionStep
{
public CustomFormatTransactionData Transactions { get; } = new();
diff --git a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStep.cs b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStep.cs
similarity index 92%
rename from src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStep.cs
rename to src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStep.cs
index fe0110cc..d567779f 100644
--- a/src/Trash/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStep.cs
+++ b/src/TrashLib/Radarr/CustomFormat/Processors/PersistenceSteps/QualityProfileApiPersistenceStep.cs
@@ -2,14 +2,14 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
+using Common.Extensions;
using Newtonsoft.Json.Linq;
-using Trash.Extensions;
-using Trash.Radarr.CustomFormat.Api;
-using Trash.Radarr.CustomFormat.Models;
+using TrashLib.Radarr.CustomFormat.Api;
+using TrashLib.Radarr.CustomFormat.Models;
-namespace Trash.Radarr.CustomFormat.Processors.PersistenceSteps
+namespace TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps
{
- public class QualityProfileApiPersistenceStep : IQualityProfileApiPersistenceStep
+ internal class QualityProfileApiPersistenceStep : IQualityProfileApiPersistenceStep
{
private readonly List _invalidProfileNames = new();
private readonly Dictionary> _updatedScores = new();
diff --git a/src/Trash/Radarr/QualityDefinition/Api/IQualityDefinitionService.cs b/src/TrashLib/Radarr/QualityDefinition/Api/IQualityDefinitionService.cs
similarity index 76%
rename from src/Trash/Radarr/QualityDefinition/Api/IQualityDefinitionService.cs
rename to src/TrashLib/Radarr/QualityDefinition/Api/IQualityDefinitionService.cs
index 7f0f955e..84d3e08e 100644
--- a/src/Trash/Radarr/QualityDefinition/Api/IQualityDefinitionService.cs
+++ b/src/TrashLib/Radarr/QualityDefinition/Api/IQualityDefinitionService.cs
@@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-using Trash.Radarr.QualityDefinition.Api.Objects;
+using TrashLib.Radarr.QualityDefinition.Api.Objects;
-namespace Trash.Radarr.QualityDefinition.Api
+namespace TrashLib.Radarr.QualityDefinition.Api
{
public interface IQualityDefinitionService
{
diff --git a/src/Trash/Radarr/QualityDefinition/Api/Objects/RadarrQualityDefinitionItem.cs b/src/TrashLib/Radarr/QualityDefinition/Api/Objects/RadarrQualityDefinitionItem.cs
similarity index 93%
rename from src/Trash/Radarr/QualityDefinition/Api/Objects/RadarrQualityDefinitionItem.cs
rename to src/TrashLib/Radarr/QualityDefinition/Api/Objects/RadarrQualityDefinitionItem.cs
index 0ae6e4e2..606586b9 100644
--- a/src/Trash/Radarr/QualityDefinition/Api/Objects/RadarrQualityDefinitionItem.cs
+++ b/src/TrashLib/Radarr/QualityDefinition/Api/Objects/RadarrQualityDefinitionItem.cs
@@ -1,6 +1,6 @@
using JetBrains.Annotations;
-namespace Trash.Radarr.QualityDefinition.Api.Objects
+namespace TrashLib.Radarr.QualityDefinition.Api.Objects
{
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
public class RadarrQualityItem
diff --git a/src/Trash/Radarr/QualityDefinition/Api/QualityDefinitionService.cs b/src/TrashLib/Radarr/QualityDefinition/Api/QualityDefinitionService.cs
similarity index 84%
rename from src/Trash/Radarr/QualityDefinition/Api/QualityDefinitionService.cs
rename to src/TrashLib/Radarr/QualityDefinition/Api/QualityDefinitionService.cs
index 59e9edef..51b54343 100644
--- a/src/Trash/Radarr/QualityDefinition/Api/QualityDefinitionService.cs
+++ b/src/TrashLib/Radarr/QualityDefinition/Api/QualityDefinitionService.cs
@@ -2,12 +2,11 @@
using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
-using Trash.Config;
-using Trash.Radarr.QualityDefinition.Api.Objects;
+using TrashLib.Radarr.QualityDefinition.Api.Objects;
-namespace Trash.Radarr.QualityDefinition.Api
+namespace TrashLib.Radarr.QualityDefinition.Api
{
- public class QualityDefinitionService : IQualityDefinitionService
+ internal class QualityDefinitionService : IQualityDefinitionService
{
private readonly IServerInfo _serverInfo;
diff --git a/src/Trash/Radarr/QualityDefinition/IRadarrQualityDefinitionGuideParser.cs b/src/TrashLib/Radarr/QualityDefinition/IRadarrQualityDefinitionGuideParser.cs
similarity index 86%
rename from src/Trash/Radarr/QualityDefinition/IRadarrQualityDefinitionGuideParser.cs
rename to src/TrashLib/Radarr/QualityDefinition/IRadarrQualityDefinitionGuideParser.cs
index f1981bb3..684dec45 100644
--- a/src/Trash/Radarr/QualityDefinition/IRadarrQualityDefinitionGuideParser.cs
+++ b/src/TrashLib/Radarr/QualityDefinition/IRadarrQualityDefinitionGuideParser.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-namespace Trash.Radarr.QualityDefinition
+namespace TrashLib.Radarr.QualityDefinition
{
public interface IRadarrQualityDefinitionGuideParser
{
diff --git a/src/TrashLib/Radarr/QualityDefinition/IRadarrQualityDefinitionUpdater.cs b/src/TrashLib/Radarr/QualityDefinition/IRadarrQualityDefinitionUpdater.cs
new file mode 100644
index 00000000..dd946c50
--- /dev/null
+++ b/src/TrashLib/Radarr/QualityDefinition/IRadarrQualityDefinitionUpdater.cs
@@ -0,0 +1,9 @@
+using System.Threading.Tasks;
+
+namespace TrashLib.Radarr.QualityDefinition
+{
+ public interface IRadarrQualityDefinitionUpdater
+ {
+ Task Process(bool isPreview, RadarrConfiguration config);
+ }
+}
diff --git a/src/Trash/Radarr/QualityDefinition/RadarrQualityData.cs b/src/TrashLib/Radarr/QualityDefinition/RadarrQualityData.cs
similarity index 91%
rename from src/Trash/Radarr/QualityDefinition/RadarrQualityData.cs
rename to src/TrashLib/Radarr/QualityDefinition/RadarrQualityData.cs
index 0d163efb..aa1823c0 100644
--- a/src/Trash/Radarr/QualityDefinition/RadarrQualityData.cs
+++ b/src/TrashLib/Radarr/QualityDefinition/RadarrQualityData.cs
@@ -1,7 +1,7 @@
using System;
-using Trash.Sonarr.QualityDefinition;
+using TrashLib.Sonarr.QualityDefinition;
-namespace Trash.Radarr.QualityDefinition
+namespace TrashLib.Radarr.QualityDefinition
{
public class RadarrQualityData : SonarrQualityData
{
diff --git a/src/Trash/Radarr/QualityDefinition/RadarrQualityDefinitionGuideParser.cs b/src/TrashLib/Radarr/QualityDefinition/RadarrQualityDefinitionGuideParser.cs
similarity index 94%
rename from src/Trash/Radarr/QualityDefinition/RadarrQualityDefinitionGuideParser.cs
rename to src/TrashLib/Radarr/QualityDefinition/RadarrQualityDefinitionGuideParser.cs
index 5618bd76..f9e0d775 100644
--- a/src/Trash/Radarr/QualityDefinition/RadarrQualityDefinitionGuideParser.cs
+++ b/src/TrashLib/Radarr/QualityDefinition/RadarrQualityDefinitionGuideParser.cs
@@ -2,12 +2,12 @@
using System.IO;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
+using Common.Extensions;
using Flurl.Http;
-using Trash.Extensions;
-namespace Trash.Radarr.QualityDefinition
+namespace TrashLib.Radarr.QualityDefinition
{
- public class RadarrQualityDefinitionGuideParser : IRadarrQualityDefinitionGuideParser
+ internal class RadarrQualityDefinitionGuideParser : IRadarrQualityDefinitionGuideParser
{
private readonly Regex _regexHeader = new(@"^#+", RegexOptions.Compiled);
diff --git a/src/Trash/Radarr/QualityDefinition/RadarrQualityDefinitionType.cs b/src/TrashLib/Radarr/QualityDefinition/RadarrQualityDefinitionType.cs
similarity index 61%
rename from src/Trash/Radarr/QualityDefinition/RadarrQualityDefinitionType.cs
rename to src/TrashLib/Radarr/QualityDefinition/RadarrQualityDefinitionType.cs
index 6df551f7..a736046d 100644
--- a/src/Trash/Radarr/QualityDefinition/RadarrQualityDefinitionType.cs
+++ b/src/TrashLib/Radarr/QualityDefinition/RadarrQualityDefinitionType.cs
@@ -1,4 +1,4 @@
-namespace Trash.Radarr.QualityDefinition
+namespace TrashLib.Radarr.QualityDefinition
{
public enum RadarrQualityDefinitionType
{
diff --git a/src/Trash/Radarr/QualityDefinition/RadarrQualityDefinitionUpdater.cs b/src/TrashLib/Radarr/QualityDefinition/RadarrQualityDefinitionUpdater.cs
similarity index 93%
rename from src/Trash/Radarr/QualityDefinition/RadarrQualityDefinitionUpdater.cs
rename to src/TrashLib/Radarr/QualityDefinition/RadarrQualityDefinitionUpdater.cs
index 221f1b19..ee91deb0 100644
--- a/src/Trash/Radarr/QualityDefinition/RadarrQualityDefinitionUpdater.cs
+++ b/src/TrashLib/Radarr/QualityDefinition/RadarrQualityDefinitionUpdater.cs
@@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Serilog;
-using Trash.Radarr.QualityDefinition.Api;
-using Trash.Radarr.QualityDefinition.Api.Objects;
+using TrashLib.Radarr.QualityDefinition.Api;
+using TrashLib.Radarr.QualityDefinition.Api.Objects;
-namespace Trash.Radarr.QualityDefinition
+namespace TrashLib.Radarr.QualityDefinition
{
- public class RadarrQualityDefinitionUpdater
+ internal class RadarrQualityDefinitionUpdater : IRadarrQualityDefinitionUpdater
{
private readonly IQualityDefinitionService _api;
private readonly IRadarrQualityDefinitionGuideParser _parser;
@@ -23,22 +23,7 @@ namespace Trash.Radarr.QualityDefinition
private ILogger Log { get; }
- private static void PrintQualityPreview(IEnumerable quality)
- {
- Console.WriteLine("");
- const string format = "{0,-20} {1,-10} {2,-15} {3,-15}";
- Console.WriteLine(format, "Quality", "Min", "Max", "Preferred");
- Console.WriteLine(format, "-------", "---", "---", "---------");
-
- foreach (var q in quality)
- {
- Console.WriteLine(format, q.Name, q.AnnotatedMin, q.AnnotatedMax, q.AnnotatedPreferred);
- }
-
- Console.WriteLine("");
- }
-
- public async Task Process(IRadarrCommand args, RadarrConfiguration config)
+ public async Task Process(bool isPreview, RadarrConfiguration config)
{
Log.Information("Processing Quality Definition: {QualityDefinition}", config.QualityDefinition!.Type);
var qualityDefinitions = _parser.ParseMarkdown(await _parser.GetMarkdownData());
@@ -62,7 +47,7 @@ namespace Trash.Radarr.QualityDefinition
quality.Preferred = quality.InterpolatedPreferred(config.QualityDefinition.PreferredRatio);
}
- if (args.Preview)
+ if (isPreview)
{
PrintQualityPreview(selectedQuality);
return;
@@ -71,6 +56,21 @@ namespace Trash.Radarr.QualityDefinition
await ProcessQualityDefinition(selectedQuality);
}
+ private static void PrintQualityPreview(IEnumerable quality)
+ {
+ Console.WriteLine("");
+ const string format = "{0,-20} {1,-10} {2,-15} {3,-15}";
+ Console.WriteLine(format, "Quality", "Min", "Max", "Preferred");
+ Console.WriteLine(format, "-------", "---", "---", "---------");
+
+ foreach (var q in quality)
+ {
+ Console.WriteLine(format, q.Name, q.AnnotatedMin, q.AnnotatedMax, q.AnnotatedPreferred);
+ }
+
+ Console.WriteLine("");
+ }
+
private async Task ProcessQualityDefinition(IEnumerable guideQuality)
{
var serverQuality = await _api.GetQualityDefinition();
diff --git a/src/TrashLib/Radarr/RadarrAutofacModule.cs b/src/TrashLib/Radarr/RadarrAutofacModule.cs
new file mode 100644
index 00000000..e3da3f6e
--- /dev/null
+++ b/src/TrashLib/Radarr/RadarrAutofacModule.cs
@@ -0,0 +1,57 @@
+using Autofac;
+using Autofac.Extras.AggregateService;
+using TrashLib.Config;
+using TrashLib.Radarr.CustomFormat;
+using TrashLib.Radarr.CustomFormat.Api;
+using TrashLib.Radarr.CustomFormat.Guide;
+using TrashLib.Radarr.CustomFormat.Processors;
+using TrashLib.Radarr.CustomFormat.Processors.GuideSteps;
+using TrashLib.Radarr.CustomFormat.Processors.PersistenceSteps;
+using TrashLib.Radarr.QualityDefinition;
+using TrashLib.Radarr.QualityDefinition.Api;
+
+namespace TrashLib.Radarr
+{
+ public class RadarrAutofacModule : Module
+ {
+ protected override void Load(ContainerBuilder builder)
+ {
+ // Services
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+
+ builder.Register(c =>
+ {
+ var config = c.Resolve().ActiveConfiguration;
+ return new ServerInfo(config.BaseUrl, config.ApiKey);
+ })
+ .As();
+
+ // Quality Definition Support
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+
+ // Custom Format Support
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+
+ // Guide Processor
+ builder.RegisterType()
+ .As<
+ IGuideProcessor>(); // todo: register as singleton to avoid parsing guide multiple times when using 2 or more instances in config
+ builder.RegisterAggregateService();
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+
+ // Persistence Processor
+ builder.RegisterType().As();
+ builder.RegisterAggregateService();
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+ }
+ }
+}
diff --git a/src/Trash/Radarr/RadarrConfiguration.cs b/src/TrashLib/Radarr/RadarrConfiguration.cs
similarity index 96%
rename from src/Trash/Radarr/RadarrConfiguration.cs
rename to src/TrashLib/Radarr/RadarrConfiguration.cs
index 5a9930e2..0cb4cdc4 100644
--- a/src/Trash/Radarr/RadarrConfiguration.cs
+++ b/src/TrashLib/Radarr/RadarrConfiguration.cs
@@ -2,10 +2,10 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using JetBrains.Annotations;
-using Trash.Config;
-using Trash.Radarr.QualityDefinition;
+using TrashLib.Config;
+using TrashLib.Radarr.QualityDefinition;
-namespace Trash.Radarr
+namespace TrashLib.Radarr
{
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
public class RadarrConfiguration : ServiceConfiguration
diff --git a/src/Trash/Config/ServerInfo.cs b/src/TrashLib/ServerInfo.cs
similarity index 87%
rename from src/Trash/Config/ServerInfo.cs
rename to src/TrashLib/ServerInfo.cs
index d3a92766..8fab512e 100644
--- a/src/Trash/Config/ServerInfo.cs
+++ b/src/TrashLib/ServerInfo.cs
@@ -1,8 +1,8 @@
using Flurl;
-namespace Trash.Config
+namespace TrashLib
{
- public class ServerInfo : IServerInfo
+ internal class ServerInfo : IServerInfo
{
private readonly string _apiKey;
private readonly string _baseUrl;
diff --git a/src/Trash/Sonarr/Api/ISonarrApi.cs b/src/TrashLib/Sonarr/Api/ISonarrApi.cs
similarity index 91%
rename from src/Trash/Sonarr/Api/ISonarrApi.cs
rename to src/TrashLib/Sonarr/Api/ISonarrApi.cs
index 87b117db..23f06bfe 100644
--- a/src/Trash/Sonarr/Api/ISonarrApi.cs
+++ b/src/TrashLib/Sonarr/Api/ISonarrApi.cs
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
-using Trash.Sonarr.Api.Objects;
+using TrashLib.Sonarr.Api.Objects;
-namespace Trash.Sonarr.Api
+namespace TrashLib.Sonarr.Api
{
public interface ISonarrApi
{
diff --git a/src/Trash/Sonarr/Api/Objects/SonarrQualityDefinitionItem.cs b/src/TrashLib/Sonarr/Api/Objects/SonarrQualityDefinitionItem.cs
similarity index 94%
rename from src/Trash/Sonarr/Api/Objects/SonarrQualityDefinitionItem.cs
rename to src/TrashLib/Sonarr/Api/Objects/SonarrQualityDefinitionItem.cs
index c25f970c..9c1d8bb7 100644
--- a/src/Trash/Sonarr/Api/Objects/SonarrQualityDefinitionItem.cs
+++ b/src/TrashLib/Sonarr/Api/Objects/SonarrQualityDefinitionItem.cs
@@ -1,6 +1,6 @@
using JetBrains.Annotations;
-namespace Trash.Sonarr.Api.Objects
+namespace TrashLib.Sonarr.Api.Objects
{
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
public class SonarrQualityItem
diff --git a/src/Trash/Sonarr/Api/Objects/SonarrReleaseProfile.cs b/src/TrashLib/Sonarr/Api/Objects/SonarrReleaseProfile.cs
similarity index 96%
rename from src/Trash/Sonarr/Api/Objects/SonarrReleaseProfile.cs
rename to src/TrashLib/Sonarr/Api/Objects/SonarrReleaseProfile.cs
index 48a3ecd4..b563face 100644
--- a/src/Trash/Sonarr/Api/Objects/SonarrReleaseProfile.cs
+++ b/src/TrashLib/Sonarr/Api/Objects/SonarrReleaseProfile.cs
@@ -2,7 +2,7 @@
using JetBrains.Annotations;
using Newtonsoft.Json;
-namespace Trash.Sonarr.Api.Objects
+namespace TrashLib.Sonarr.Api.Objects
{
[UsedImplicitly(ImplicitUseKindFlags.Assign, ImplicitUseTargetFlags.Members)]
public class SonarrPreferredTerm
diff --git a/src/Trash/Sonarr/Api/Objects/SonarrTag.cs b/src/TrashLib/Sonarr/Api/Objects/SonarrTag.cs
similarity index 75%
rename from src/Trash/Sonarr/Api/Objects/SonarrTag.cs
rename to src/TrashLib/Sonarr/Api/Objects/SonarrTag.cs
index 025de1c7..27f2e596 100644
--- a/src/Trash/Sonarr/Api/Objects/SonarrTag.cs
+++ b/src/TrashLib/Sonarr/Api/Objects/SonarrTag.cs
@@ -1,4 +1,4 @@
-namespace Trash.Sonarr.Api.Objects
+namespace TrashLib.Sonarr.Api.Objects
{
public class SonarrTag
{
diff --git a/src/Trash/Sonarr/Api/SonarrApi.cs b/src/TrashLib/Sonarr/Api/SonarrApi.cs
similarity index 97%
rename from src/Trash/Sonarr/Api/SonarrApi.cs
rename to src/TrashLib/Sonarr/Api/SonarrApi.cs
index 8d10b542..643ab71c 100644
--- a/src/Trash/Sonarr/Api/SonarrApi.cs
+++ b/src/TrashLib/Sonarr/Api/SonarrApi.cs
@@ -3,10 +3,9 @@ using System.Collections.Generic;
using System.Threading.Tasks;
using Flurl;
using Flurl.Http;
-using Trash.Config;
-using Trash.Sonarr.Api.Objects;
+using TrashLib.Sonarr.Api.Objects;
-namespace Trash.Sonarr.Api
+namespace TrashLib.Sonarr.Api
{
public class SonarrApi : ISonarrApi
{
diff --git a/src/Trash/Sonarr/QualityDefinition/ISonarrQualityDefinitionGuideParser.cs b/src/TrashLib/Sonarr/QualityDefinition/ISonarrQualityDefinitionGuideParser.cs
similarity index 86%
rename from src/Trash/Sonarr/QualityDefinition/ISonarrQualityDefinitionGuideParser.cs
rename to src/TrashLib/Sonarr/QualityDefinition/ISonarrQualityDefinitionGuideParser.cs
index d6880978..48d77eab 100644
--- a/src/Trash/Sonarr/QualityDefinition/ISonarrQualityDefinitionGuideParser.cs
+++ b/src/TrashLib/Sonarr/QualityDefinition/ISonarrQualityDefinitionGuideParser.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-namespace Trash.Sonarr.QualityDefinition
+namespace TrashLib.Sonarr.QualityDefinition
{
public interface ISonarrQualityDefinitionGuideParser
{
diff --git a/src/TrashLib/Sonarr/QualityDefinition/ISonarrQualityDefinitionUpdater.cs b/src/TrashLib/Sonarr/QualityDefinition/ISonarrQualityDefinitionUpdater.cs
new file mode 100644
index 00000000..e33f7cef
--- /dev/null
+++ b/src/TrashLib/Sonarr/QualityDefinition/ISonarrQualityDefinitionUpdater.cs
@@ -0,0 +1,9 @@
+using System.Threading.Tasks;
+
+namespace TrashLib.Sonarr.QualityDefinition
+{
+ public interface ISonarrQualityDefinitionUpdater
+ {
+ Task Process(bool isPreview, SonarrConfiguration config);
+ }
+}
diff --git a/src/Trash/Sonarr/QualityDefinition/SonarrQualityData.cs b/src/TrashLib/Sonarr/QualityDefinition/SonarrQualityData.cs
similarity index 96%
rename from src/Trash/Sonarr/QualityDefinition/SonarrQualityData.cs
rename to src/TrashLib/Sonarr/QualityDefinition/SonarrQualityData.cs
index 45cd60e5..983ccd5a 100644
--- a/src/Trash/Sonarr/QualityDefinition/SonarrQualityData.cs
+++ b/src/TrashLib/Sonarr/QualityDefinition/SonarrQualityData.cs
@@ -1,7 +1,7 @@
using System.Globalization;
using System.Text;
-namespace Trash.Sonarr.QualityDefinition
+namespace TrashLib.Sonarr.QualityDefinition
{
public class SonarrQualityData
{
diff --git a/src/Trash/Sonarr/QualityDefinition/SonarrQualityDefinitionGuideParser.cs b/src/TrashLib/Sonarr/QualityDefinition/SonarrQualityDefinitionGuideParser.cs
similarity index 94%
rename from src/Trash/Sonarr/QualityDefinition/SonarrQualityDefinitionGuideParser.cs
rename to src/TrashLib/Sonarr/QualityDefinition/SonarrQualityDefinitionGuideParser.cs
index cff6a4b8..e02c2041 100644
--- a/src/Trash/Sonarr/QualityDefinition/SonarrQualityDefinitionGuideParser.cs
+++ b/src/TrashLib/Sonarr/QualityDefinition/SonarrQualityDefinitionGuideParser.cs
@@ -2,12 +2,12 @@
using System.IO;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
+using Common.Extensions;
using Flurl.Http;
-using Trash.Extensions;
-namespace Trash.Sonarr.QualityDefinition
+namespace TrashLib.Sonarr.QualityDefinition
{
- public class SonarrQualityDefinitionGuideParser : ISonarrQualityDefinitionGuideParser
+ internal class SonarrQualityDefinitionGuideParser : ISonarrQualityDefinitionGuideParser
{
private readonly Regex _regexHeader = new(@"^#+", RegexOptions.Compiled);
diff --git a/src/Trash/Sonarr/QualityDefinition/SonarrQualityDefinitionType.cs b/src/TrashLib/Sonarr/QualityDefinition/SonarrQualityDefinitionType.cs
similarity index 69%
rename from src/Trash/Sonarr/QualityDefinition/SonarrQualityDefinitionType.cs
rename to src/TrashLib/Sonarr/QualityDefinition/SonarrQualityDefinitionType.cs
index 8af7dbb4..b048289c 100644
--- a/src/Trash/Sonarr/QualityDefinition/SonarrQualityDefinitionType.cs
+++ b/src/TrashLib/Sonarr/QualityDefinition/SonarrQualityDefinitionType.cs
@@ -1,4 +1,4 @@
-namespace Trash.Sonarr.QualityDefinition
+namespace TrashLib.Sonarr.QualityDefinition
{
public enum SonarrQualityDefinitionType
{
diff --git a/src/Trash/Sonarr/QualityDefinition/SonarrQualityDefinitionUpdater.cs b/src/TrashLib/Sonarr/QualityDefinition/SonarrQualityDefinitionUpdater.cs
similarity index 95%
rename from src/Trash/Sonarr/QualityDefinition/SonarrQualityDefinitionUpdater.cs
rename to src/TrashLib/Sonarr/QualityDefinition/SonarrQualityDefinitionUpdater.cs
index c49c2bf1..4ba1822b 100644
--- a/src/Trash/Sonarr/QualityDefinition/SonarrQualityDefinitionUpdater.cs
+++ b/src/TrashLib/Sonarr/QualityDefinition/SonarrQualityDefinitionUpdater.cs
@@ -4,12 +4,12 @@ using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Serilog;
-using Trash.Sonarr.Api;
-using Trash.Sonarr.Api.Objects;
+using TrashLib.Sonarr.Api;
+using TrashLib.Sonarr.Api.Objects;
-namespace Trash.Sonarr.QualityDefinition
+namespace TrashLib.Sonarr.QualityDefinition
{
- public class SonarrQualityDefinitionUpdater
+ internal class SonarrQualityDefinitionUpdater : ISonarrQualityDefinitionUpdater
{
private readonly ISonarrApi _api;
private readonly ISonarrQualityDefinitionGuideParser _parser;
@@ -25,6 +25,31 @@ namespace Trash.Sonarr.QualityDefinition
private ILogger Log { get; }
+ public async Task Process(bool isPreview, SonarrConfiguration config)
+ {
+ Log.Information("Processing Quality Definition: {QualityDefinition}", config.QualityDefinition);
+ var qualityDefinitions = _parser.ParseMarkdown(await _parser.GetMarkdownData());
+ List selectedQuality;
+
+ if (config.QualityDefinition == SonarrQualityDefinitionType.Hybrid)
+ {
+ selectedQuality = BuildHybridQuality(qualityDefinitions[SonarrQualityDefinitionType.Anime],
+ qualityDefinitions[SonarrQualityDefinitionType.Series]);
+ }
+ else
+ {
+ selectedQuality = qualityDefinitions[config.QualityDefinition!.Value];
+ }
+
+ if (isPreview)
+ {
+ PrintQualityPreview(selectedQuality);
+ return;
+ }
+
+ await ProcessQualityDefinition(selectedQuality);
+ }
+
private List BuildHybridQuality(IReadOnlyCollection anime,
IEnumerable series)
{
@@ -80,31 +105,6 @@ namespace Trash.Sonarr.QualityDefinition
Console.WriteLine("");
}
- public async Task Process(ISonarrCommand args, SonarrConfiguration config)
- {
- Log.Information("Processing Quality Definition: {QualityDefinition}", config.QualityDefinition);
- var qualityDefinitions = _parser.ParseMarkdown(await _parser.GetMarkdownData());
- List selectedQuality;
-
- if (config.QualityDefinition == SonarrQualityDefinitionType.Hybrid)
- {
- selectedQuality = BuildHybridQuality(qualityDefinitions[SonarrQualityDefinitionType.Anime],
- qualityDefinitions[SonarrQualityDefinitionType.Series]);
- }
- else
- {
- selectedQuality = qualityDefinitions[config.QualityDefinition!.Value];
- }
-
- if (args.Preview)
- {
- PrintQualityPreview(selectedQuality);
- return;
- }
-
- await ProcessQualityDefinition(selectedQuality);
- }
-
private async Task ProcessQualityDefinition(IEnumerable guideQuality)
{
var serverQuality = await _api.GetQualityDefinition();
diff --git a/src/Trash/Sonarr/ReleaseProfile/FilteredProfileData.cs b/src/TrashLib/Sonarr/ReleaseProfile/FilteredProfileData.cs
similarity index 96%
rename from src/Trash/Sonarr/ReleaseProfile/FilteredProfileData.cs
rename to src/TrashLib/Sonarr/ReleaseProfile/FilteredProfileData.cs
index 62090719..f57c72e9 100644
--- a/src/Trash/Sonarr/ReleaseProfile/FilteredProfileData.cs
+++ b/src/TrashLib/Sonarr/ReleaseProfile/FilteredProfileData.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
-namespace Trash.Sonarr.ReleaseProfile
+namespace TrashLib.Sonarr.ReleaseProfile
{
public class FilteredProfileData
{
diff --git a/src/Trash/Sonarr/ReleaseProfile/IReleaseProfileGuideParser.cs b/src/TrashLib/Sonarr/ReleaseProfile/IReleaseProfileGuideParser.cs
similarity index 88%
rename from src/Trash/Sonarr/ReleaseProfile/IReleaseProfileGuideParser.cs
rename to src/TrashLib/Sonarr/ReleaseProfile/IReleaseProfileGuideParser.cs
index 75f2860a..e6df1faf 100644
--- a/src/Trash/Sonarr/ReleaseProfile/IReleaseProfileGuideParser.cs
+++ b/src/TrashLib/Sonarr/ReleaseProfile/IReleaseProfileGuideParser.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
-namespace Trash.Sonarr.ReleaseProfile
+namespace TrashLib.Sonarr.ReleaseProfile
{
public interface IReleaseProfileGuideParser
{
diff --git a/src/TrashLib/Sonarr/ReleaseProfile/IReleaseProfileUpdater.cs b/src/TrashLib/Sonarr/ReleaseProfile/IReleaseProfileUpdater.cs
new file mode 100644
index 00000000..3e9cd360
--- /dev/null
+++ b/src/TrashLib/Sonarr/ReleaseProfile/IReleaseProfileUpdater.cs
@@ -0,0 +1,9 @@
+using System.Threading.Tasks;
+
+namespace TrashLib.Sonarr.ReleaseProfile
+{
+ public interface IReleaseProfileUpdater
+ {
+ Task Process(bool isPreview, SonarrConfiguration config);
+ }
+}
diff --git a/src/Trash/Sonarr/ReleaseProfile/ParserState.cs b/src/TrashLib/Sonarr/ReleaseProfile/ParserState.cs
similarity index 97%
rename from src/Trash/Sonarr/ReleaseProfile/ParserState.cs
rename to src/TrashLib/Sonarr/ReleaseProfile/ParserState.cs
index 5100ec77..42c2ab72 100644
--- a/src/Trash/Sonarr/ReleaseProfile/ParserState.cs
+++ b/src/TrashLib/Sonarr/ReleaseProfile/ParserState.cs
@@ -1,9 +1,9 @@
using System;
using System.Collections.Generic;
+using Common.Extensions;
using Serilog;
-using Trash.Extensions;
-namespace Trash.Sonarr.ReleaseProfile
+namespace TrashLib.Sonarr.ReleaseProfile
{
public enum TermCategory
{
diff --git a/src/Trash/Sonarr/ReleaseProfile/ProfileData.cs b/src/TrashLib/Sonarr/ReleaseProfile/ProfileData.cs
similarity index 96%
rename from src/Trash/Sonarr/ReleaseProfile/ProfileData.cs
rename to src/TrashLib/Sonarr/ReleaseProfile/ProfileData.cs
index 29b49677..0ec2c6cd 100644
--- a/src/Trash/Sonarr/ReleaseProfile/ProfileData.cs
+++ b/src/TrashLib/Sonarr/ReleaseProfile/ProfileData.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Trash.Sonarr.ReleaseProfile
+namespace TrashLib.Sonarr.ReleaseProfile
{
public class ProfileDataOptional
{
diff --git a/src/Trash/Sonarr/ReleaseProfile/ReleaseProfileGuideParser.cs b/src/TrashLib/Sonarr/ReleaseProfile/ReleaseProfileGuideParser.cs
similarity index 98%
rename from src/Trash/Sonarr/ReleaseProfile/ReleaseProfileGuideParser.cs
rename to src/TrashLib/Sonarr/ReleaseProfile/ReleaseProfileGuideParser.cs
index 736be98a..aed506e8 100644
--- a/src/Trash/Sonarr/ReleaseProfile/ReleaseProfileGuideParser.cs
+++ b/src/TrashLib/Sonarr/ReleaseProfile/ReleaseProfileGuideParser.cs
@@ -3,14 +3,14 @@ using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
+using Common.Extensions;
using Flurl;
using Flurl.Http;
using Serilog;
-using Trash.Extensions;
-namespace Trash.Sonarr.ReleaseProfile
+namespace TrashLib.Sonarr.ReleaseProfile
{
- public class ReleaseProfileGuideParser : IReleaseProfileGuideParser
+ internal class ReleaseProfileGuideParser : IReleaseProfileGuideParser
{
private readonly Dictionary _markdownDocNames = new()
{
diff --git a/src/Trash/Sonarr/ReleaseProfile/ReleaseProfileType.cs b/src/TrashLib/Sonarr/ReleaseProfile/ReleaseProfileType.cs
similarity index 64%
rename from src/Trash/Sonarr/ReleaseProfile/ReleaseProfileType.cs
rename to src/TrashLib/Sonarr/ReleaseProfile/ReleaseProfileType.cs
index 40296749..e90c92fb 100644
--- a/src/Trash/Sonarr/ReleaseProfile/ReleaseProfileType.cs
+++ b/src/TrashLib/Sonarr/ReleaseProfile/ReleaseProfileType.cs
@@ -1,4 +1,4 @@
-namespace Trash.Sonarr.ReleaseProfile
+namespace TrashLib.Sonarr.ReleaseProfile
{
public enum ReleaseProfileType
{
diff --git a/src/Trash/Sonarr/ReleaseProfile/ReleaseProfileUpdater.cs b/src/TrashLib/Sonarr/ReleaseProfile/ReleaseProfileUpdater.cs
similarity index 91%
rename from src/Trash/Sonarr/ReleaseProfile/ReleaseProfileUpdater.cs
rename to src/TrashLib/Sonarr/ReleaseProfile/ReleaseProfileUpdater.cs
index b401b25c..b25a6b71 100644
--- a/src/Trash/Sonarr/ReleaseProfile/ReleaseProfileUpdater.cs
+++ b/src/TrashLib/Sonarr/ReleaseProfile/ReleaseProfileUpdater.cs
@@ -2,15 +2,15 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
-using CliFx.Exceptions;
+using Common.Extensions;
using Serilog;
-using Trash.Extensions;
-using Trash.Sonarr.Api;
-using Trash.Sonarr.Api.Objects;
+using TrashLib.ExceptionTypes;
+using TrashLib.Sonarr.Api;
+using TrashLib.Sonarr.Api.Objects;
-namespace Trash.Sonarr.ReleaseProfile
+namespace TrashLib.Sonarr.ReleaseProfile
{
- public class ReleaseProfileUpdater
+ internal class ReleaseProfileUpdater : IReleaseProfileUpdater
{
private readonly ISonarrApi _api;
private readonly IReleaseProfileGuideParser _parser;
@@ -24,6 +24,29 @@ namespace Trash.Sonarr.ReleaseProfile
private ILogger Log { get; }
+ public async Task Process(bool isPreview, SonarrConfiguration config)
+ {
+ foreach (var profile in config.ReleaseProfiles)
+ {
+ Log.Information("Processing Release Profile: {ProfileName}", profile.Type);
+ var markdown = await _parser.GetMarkdownData(profile.Type);
+ var profiles = Utils.FilterProfiles(_parser.ParseMarkdown(profile, markdown));
+
+ if (profile.Filter.IncludeOptional)
+ {
+ Log.Information("Configuration is set to allow optional terms to be synchronized");
+ }
+
+ if (isPreview)
+ {
+ Utils.PrintTermsAndScores(profiles);
+ continue;
+ }
+
+ await ProcessReleaseProfiles(profiles, profile);
+ }
+ }
+
private async Task DoVersionEnforcement()
{
// Since this script requires a specific version of v3 Sonarr that implements name support for
@@ -33,9 +56,9 @@ namespace Trash.Sonarr.ReleaseProfile
var version = await _api.GetVersion();
if (version < minimumVersion)
{
- Log.Error("Your Sonarr version {CurrentVersion} does not meet the minimum " +
- "required version of {MinimumVersion} to use this program", version, minimumVersion);
- throw new CommandException("Exiting due to version incompatibility");
+ throw new VersionException(
+ $"Your Sonarr version {version} does not meet the minimum " +
+ $"required version of {minimumVersion} to use this program");
}
}
@@ -141,28 +164,5 @@ namespace Trash.Sonarr.ReleaseProfile
}
}
}
-
- public async Task Process(ISonarrCommand args, SonarrConfiguration config)
- {
- foreach (var profile in config.ReleaseProfiles)
- {
- Log.Information("Processing Release Profile: {ProfileName}", profile.Type);
- var markdown = await _parser.GetMarkdownData(profile.Type);
- var profiles = Utils.FilterProfiles(_parser.ParseMarkdown(profile, markdown));
-
- if (profile.Filter.IncludeOptional)
- {
- Log.Information("Configuration is set to allow optional terms to be synchronized");
- }
-
- if (args.Preview)
- {
- Utils.PrintTermsAndScores(profiles);
- continue;
- }
-
- await ProcessReleaseProfiles(profiles, profile);
- }
- }
}
}
diff --git a/src/Trash/Sonarr/ReleaseProfile/ScopedState.cs b/src/TrashLib/Sonarr/ReleaseProfile/ScopedState.cs
similarity index 97%
rename from src/Trash/Sonarr/ReleaseProfile/ScopedState.cs
rename to src/TrashLib/Sonarr/ReleaseProfile/ScopedState.cs
index c4df2768..8dab755d 100644
--- a/src/Trash/Sonarr/ReleaseProfile/ScopedState.cs
+++ b/src/TrashLib/Sonarr/ReleaseProfile/ScopedState.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace Trash.Sonarr.ReleaseProfile
+namespace TrashLib.Sonarr.ReleaseProfile
{
public class ScopedState
{
diff --git a/src/Trash/Sonarr/ReleaseProfile/Utils.cs b/src/TrashLib/Sonarr/ReleaseProfile/Utils.cs
similarity index 98%
rename from src/Trash/Sonarr/ReleaseProfile/Utils.cs
rename to src/TrashLib/Sonarr/ReleaseProfile/Utils.cs
index e5d16a2e..330b902c 100644
--- a/src/Trash/Sonarr/ReleaseProfile/Utils.cs
+++ b/src/TrashLib/Sonarr/ReleaseProfile/Utils.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Linq;
-namespace Trash.Sonarr.ReleaseProfile
+namespace TrashLib.Sonarr.ReleaseProfile
{
using ProfileDataCollection = IDictionary;
diff --git a/src/TrashLib/Sonarr/SonarrAutofacModule.cs b/src/TrashLib/Sonarr/SonarrAutofacModule.cs
new file mode 100644
index 00000000..1a745735
--- /dev/null
+++ b/src/TrashLib/Sonarr/SonarrAutofacModule.cs
@@ -0,0 +1,23 @@
+using Autofac;
+using TrashLib.Sonarr.Api;
+using TrashLib.Sonarr.QualityDefinition;
+using TrashLib.Sonarr.ReleaseProfile;
+
+namespace TrashLib.Sonarr
+{
+ public class SonarrAutofacModule : Module
+ {
+ protected override void Load(ContainerBuilder builder)
+ {
+ builder.RegisterType().As();
+
+ // Release Profile Support
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+
+ // Quality Definition Support
+ builder.RegisterType().As();
+ builder.RegisterType().As();
+ }
+ }
+}
diff --git a/src/Trash/Sonarr/SonarrConfiguration.cs b/src/TrashLib/Sonarr/SonarrConfiguration.cs
similarity index 92%
rename from src/Trash/Sonarr/SonarrConfiguration.cs
rename to src/TrashLib/Sonarr/SonarrConfiguration.cs
index fac28286..d023f91f 100644
--- a/src/Trash/Sonarr/SonarrConfiguration.cs
+++ b/src/TrashLib/Sonarr/SonarrConfiguration.cs
@@ -1,11 +1,11 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using JetBrains.Annotations;
-using Trash.Config;
-using Trash.Sonarr.QualityDefinition;
-using Trash.Sonarr.ReleaseProfile;
+using TrashLib.Config;
+using TrashLib.Sonarr.QualityDefinition;
+using TrashLib.Sonarr.ReleaseProfile;
-namespace Trash.Sonarr
+namespace TrashLib.Sonarr
{
[UsedImplicitly(ImplicitUseTargetFlags.WithMembers)]
public class SonarrConfiguration : ServiceConfiguration
diff --git a/src/TrashLib/TrashLib.csproj b/src/TrashLib/TrashLib.csproj
new file mode 100644
index 00000000..eef0e7fe
--- /dev/null
+++ b/src/TrashLib/TrashLib.csproj
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/TrashUpdater.sln b/src/TrashUpdater.sln
index ca9b80fa..ccdee671 100644
--- a/src/TrashUpdater.sln
+++ b/src/TrashUpdater.sln
@@ -21,6 +21,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Tests", "Common.Test
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Trash.TestLibrary", "Trash.TestLibrary\Trash.TestLibrary.csproj", "{33226068-65E3-4890-8671-59A56BA3F6F0}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrashLib", "TrashLib\TrashLib.csproj", "{4F6ACBA6-9A7D-487C-ACC1-787CCC90A381}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrashLib.Tests", "TrashLib.Tests\TrashLib.Tests.csproj", "{A4EC7E0D-C591-4874-B9AC-EB12A96F3E83}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -55,6 +59,14 @@ Global
{33226068-65E3-4890-8671-59A56BA3F6F0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33226068-65E3-4890-8671-59A56BA3F6F0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33226068-65E3-4890-8671-59A56BA3F6F0}.Release|Any CPU.Build.0 = Release|Any CPU
+ {4F6ACBA6-9A7D-487C-ACC1-787CCC90A381}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {4F6ACBA6-9A7D-487C-ACC1-787CCC90A381}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {4F6ACBA6-9A7D-487C-ACC1-787CCC90A381}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {4F6ACBA6-9A7D-487C-ACC1-787CCC90A381}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A4EC7E0D-C591-4874-B9AC-EB12A96F3E83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A4EC7E0D-C591-4874-B9AC-EB12A96F3E83}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A4EC7E0D-C591-4874-B9AC-EB12A96F3E83}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A4EC7E0D-C591-4874-B9AC-EB12A96F3E83}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
EndGlobalSection