|
|
|
@ -6,6 +6,7 @@ using Recyclarr.Cli.Console.Commands.Shared;
|
|
|
|
|
using Recyclarr.Cli.Console.Helpers;
|
|
|
|
|
using Recyclarr.Cli.Migration;
|
|
|
|
|
using Recyclarr.TrashLib.Config;
|
|
|
|
|
using Recyclarr.TrashLib.Repo;
|
|
|
|
|
using Recyclarr.TrashLib.Services.Processors;
|
|
|
|
|
using Recyclarr.TrashLib.Services.Sonarr;
|
|
|
|
|
using Serilog;
|
|
|
|
@ -21,6 +22,7 @@ internal class SonarrCommand : AsyncCommand<SonarrCommand.CliSettings>
|
|
|
|
|
private readonly ILogger _log;
|
|
|
|
|
private readonly ISonarrGuideDataLister _lister;
|
|
|
|
|
private readonly IMigrationExecutor _migration;
|
|
|
|
|
private readonly IRepoUpdater _repoUpdater;
|
|
|
|
|
private readonly ISyncProcessor _syncProcessor;
|
|
|
|
|
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
@ -84,11 +86,13 @@ internal class SonarrCommand : AsyncCommand<SonarrCommand.CliSettings>
|
|
|
|
|
ILogger log,
|
|
|
|
|
ISonarrGuideDataLister lister,
|
|
|
|
|
IMigrationExecutor migration,
|
|
|
|
|
IRepoUpdater repoUpdater,
|
|
|
|
|
ISyncProcessor syncProcessor)
|
|
|
|
|
{
|
|
|
|
|
_log = log;
|
|
|
|
|
_lister = lister;
|
|
|
|
|
_migration = migration;
|
|
|
|
|
_repoUpdater = repoUpdater;
|
|
|
|
|
_syncProcessor = syncProcessor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -96,6 +100,10 @@ internal class SonarrCommand : AsyncCommand<SonarrCommand.CliSettings>
|
|
|
|
|
{
|
|
|
|
|
_log.Warning("The `sonarr` subcommand is DEPRECATED -- Use `sync` instead!");
|
|
|
|
|
|
|
|
|
|
// Will throw if migration is required, otherwise just a warning is issued.
|
|
|
|
|
_migration.CheckNeededMigrations();
|
|
|
|
|
await _repoUpdater.UpdateRepo();
|
|
|
|
|
|
|
|
|
|
if (settings.ListCustomFormats)
|
|
|
|
|
{
|
|
|
|
|
_lister.ListCustomFormats();
|
|
|
|
@ -121,9 +129,6 @@ internal class SonarrCommand : AsyncCommand<SonarrCommand.CliSettings>
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Will throw if migration is required, otherwise just a warning is issued.
|
|
|
|
|
_migration.CheckNeededMigrations();
|
|
|
|
|
|
|
|
|
|
return (int) await _syncProcessor.ProcessConfigs(settings);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|