From 4bc1c33e8169c3c09b286cbc357865aba36d72a2 Mon Sep 17 00:00:00 2001 From: Flaminel Date: Wed, 19 Mar 2025 16:02:46 +0200 Subject: [PATCH] Add option to explicitly disable the download client (#93) --- code/Common/Enums/DownloadClient.cs | 3 ++- .../Verticals/ContentBlocker/ContentBlocker.cs | 4 ++-- .../Verticals/DownloadCleaner/DownloadCleaner.cs | 4 ++-- .../DownloadClient/DownloadServiceFactory.cs | 1 + .../Verticals/QueueCleaner/QueueCleaner.cs | 2 +- variables.md | 15 ++++++++++----- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/code/Common/Enums/DownloadClient.cs b/code/Common/Enums/DownloadClient.cs index 6c72e835..7c215064 100644 --- a/code/Common/Enums/DownloadClient.cs +++ b/code/Common/Enums/DownloadClient.cs @@ -5,5 +5,6 @@ public enum DownloadClient QBittorrent, Deluge, Transmission, - None + None, + Disabled } \ No newline at end of file diff --git a/code/Infrastructure/Verticals/ContentBlocker/ContentBlocker.cs b/code/Infrastructure/Verticals/ContentBlocker/ContentBlocker.cs index 857510f4..07ee792a 100644 --- a/code/Infrastructure/Verticals/ContentBlocker/ContentBlocker.cs +++ b/code/Infrastructure/Verticals/ContentBlocker/ContentBlocker.cs @@ -55,9 +55,9 @@ public sealed class ContentBlocker : GenericHandler public override async Task ExecuteAsync() { - if (_downloadClientConfig.DownloadClient is Common.Enums.DownloadClient.None) + if (_downloadClientConfig.DownloadClient is Common.Enums.DownloadClient.None or Common.Enums.DownloadClient.Disabled) { - _logger.LogWarning("download client is set to none"); + _logger.LogWarning("download client is not set"); return; } diff --git a/code/Infrastructure/Verticals/DownloadCleaner/DownloadCleaner.cs b/code/Infrastructure/Verticals/DownloadCleaner/DownloadCleaner.cs index e5f767c3..25c79eac 100644 --- a/code/Infrastructure/Verticals/DownloadCleaner/DownloadCleaner.cs +++ b/code/Infrastructure/Verticals/DownloadCleaner/DownloadCleaner.cs @@ -50,9 +50,9 @@ public sealed class DownloadCleaner : GenericHandler public override async Task ExecuteAsync() { - if (_downloadClientConfig.DownloadClient is Common.Enums.DownloadClient.None) + if (_downloadClientConfig.DownloadClient is Common.Enums.DownloadClient.None or Common.Enums.DownloadClient.Disabled) { - _logger.LogWarning("download client is set to none"); + _logger.LogWarning("download client is not set"); return; } diff --git a/code/Infrastructure/Verticals/DownloadClient/DownloadServiceFactory.cs b/code/Infrastructure/Verticals/DownloadClient/DownloadServiceFactory.cs index d02c9753..582b3441 100644 --- a/code/Infrastructure/Verticals/DownloadClient/DownloadServiceFactory.cs +++ b/code/Infrastructure/Verticals/DownloadClient/DownloadServiceFactory.cs @@ -25,6 +25,7 @@ public sealed class DownloadServiceFactory Common.Enums.DownloadClient.Deluge => _serviceProvider.GetRequiredService(), Common.Enums.DownloadClient.Transmission => _serviceProvider.GetRequiredService(), Common.Enums.DownloadClient.None => _serviceProvider.GetRequiredService(), + Common.Enums.DownloadClient.Disabled => _serviceProvider.GetRequiredService(), _ => throw new ArgumentOutOfRangeException() }; } \ No newline at end of file diff --git a/code/Infrastructure/Verticals/QueueCleaner/QueueCleaner.cs b/code/Infrastructure/Verticals/QueueCleaner/QueueCleaner.cs index bc7df160..39914079 100644 --- a/code/Infrastructure/Verticals/QueueCleaner/QueueCleaner.cs +++ b/code/Infrastructure/Verticals/QueueCleaner/QueueCleaner.cs @@ -93,7 +93,7 @@ public sealed class QueueCleaner : GenericHandler StalledResult stalledCheckResult = new(); - if (record.Protocol is "torrent") + if (record.Protocol is "torrent" && _downloadClientConfig.DownloadClient is not Common.Enums.DownloadClient.Disabled) { if (_downloadClientConfig.DownloadClient is Common.Enums.DownloadClient.None) { diff --git a/variables.md b/variables.md index e5390351..6c64d315 100644 --- a/variables.md +++ b/variables.md @@ -135,7 +135,7 @@ - Required: No. > [!WARNING] -> Setting `QUEUECLEANER__IMPORT_FAILED_DELETE_PRIVATE=true` means you don't care about seeding, ratio, H&R and potentially losing your tracker account. +> Setting `QUEUECLEANER__IMPORT_FAILED_DELETE_PRIVATE=true` means you don't care about seeding, ratio, H&R and potentially losing your private tracker account. #### **`QUEUECLEANER__IMPORT_FAILED_IGNORE_PATTERNS`** - Patterns to look for in failed import messages that should be ignored. @@ -182,7 +182,7 @@ - Required: No. > [!WARNING] -> Setting `QUEUECLEANER__STALLED_DELETE_PRIVATE=true` means you don't care about seeding, ratio, H&R and potentially losing your tracker account. +> Setting `QUEUECLEANER__STALLED_DELETE_PRIVATE=true` means you don't care about seeding, ratio, H&R and potentially losing your private tracker account. # @@ -246,7 +246,7 @@ - Required: No. > [!WARNING] -> Setting `CONTENTBLOCKER__DELETE_PRIVATE=true` means you don't care about seeding, ratio, H&R and potentially losing your tracker account. +> Setting `CONTENTBLOCKER__DELETE_PRIVATE=true` means you don't care about seeding, ratio, H&R and potentially losing your private tracker account. # @@ -302,7 +302,7 @@ - Required: No. > [!WARNING] -> Setting `DOWNLOADCLEANER__DELETE_PRIVATE=true` means you don't care about seeding, ratio, H&R and potentially losing your tracker account. +> Setting `DOWNLOADCLEANER__DELETE_PRIVATE=true` means you don't care about seeding, ratio, H&R and potentially losing your private tracker account. #### **`DOWNLOADCLEANER__CATEGORIES__0__NAME`** - Name of the category to clean. @@ -360,13 +360,18 @@ #### **`DOWNLOAD_CLIENT`** - Specifies which download client is used by *arrs. - Type: String. -- Possible values: `none`, `qbittorrent`, `deluge`, `transmission`. +- Possible values: `none`, `qbittorrent`, `deluge`, `transmission`, `disabled`. - Default: `none` - Required: No. > [!NOTE] > Only one download client can be enabled at a time. If you have more than one download client, you should deploy multiple instances of cleanuperr. +> [!IMPORTANT] +> When the download client is set to `disabled`, the queue cleaner will be able to remove items that are failed to be imported even if there is no download client configured. This means that all downloads, including private ones, will be completely removed. +> +> Setting `DOWNLOAD_CLIENT=disabled` means you don't care about seeding, ratio, H&R and potentially losing your private tracker account. + #### **`QBITTORRENT__URL`** - URL of the qBittorrent instance. - Type: String.