From 67ffb71f748789d40edeff99c7bd6855fd2f1372 Mon Sep 17 00:00:00 2001 From: Flaminel Date: Sat, 18 Jan 2025 16:19:57 +0200 Subject: [PATCH] fixed content blocker env var usage --- .../Verticals/DownloadClient/Deluge/DelugeService.cs | 5 +++-- .../Verticals/DownloadClient/DownloadServiceBase.cs | 3 +++ .../Verticals/DownloadClient/DummyDownloadService.cs | 2 +- .../Verticals/DownloadClient/QBittorrent/QBitService.cs | 5 +++-- .../DownloadClient/Transmission/TransmissionService.cs | 5 +++-- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs index b2f95bc..0bbe1d6 100644 --- a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs @@ -20,9 +20,10 @@ public DelugeService( IOptions config, IHttpClientFactory httpClientFactory, IOptions queueCleanerConfig, + IOptions contentBlockerConfig, FilenameEvaluator filenameEvaluator, Striker striker - ) : base(logger, queueCleanerConfig, filenameEvaluator, striker) + ) : base(logger, queueCleanerConfig, contentBlockerConfig, filenameEvaluator, striker) { config.Value.Validate(); _client = new (config, httpClientFactory); @@ -92,7 +93,7 @@ ConcurrentBag regexes return false; } - if (_queueCleanerConfig.StalledIgnorePrivate && status.Private) + if (_contentBlockerConfig.IgnorePrivate && status.Private) { // ignore private trackers _logger.LogDebug("skip files check | download is private | {name}", status.Name); diff --git a/code/Infrastructure/Verticals/DownloadClient/DownloadServiceBase.cs b/code/Infrastructure/Verticals/DownloadClient/DownloadServiceBase.cs index 0089a9f..0ae5d0b 100644 --- a/code/Infrastructure/Verticals/DownloadClient/DownloadServiceBase.cs +++ b/code/Infrastructure/Verticals/DownloadClient/DownloadServiceBase.cs @@ -14,18 +14,21 @@ public abstract class DownloadServiceBase : IDownloadService { protected readonly ILogger _logger; protected readonly QueueCleanerConfig _queueCleanerConfig; + protected readonly ContentBlockerConfig _contentBlockerConfig; protected readonly FilenameEvaluator _filenameEvaluator; protected readonly Striker _striker; protected DownloadServiceBase( ILogger logger, IOptions queueCleanerConfig, + IOptions contentBlockerConfig, FilenameEvaluator filenameEvaluator, Striker striker ) { _logger = logger; _queueCleanerConfig = queueCleanerConfig.Value; + _contentBlockerConfig = contentBlockerConfig.Value; _filenameEvaluator = filenameEvaluator; _striker = striker; } diff --git a/code/Infrastructure/Verticals/DownloadClient/DummyDownloadService.cs b/code/Infrastructure/Verticals/DownloadClient/DummyDownloadService.cs index 4e0ac32..686ad51 100644 --- a/code/Infrastructure/Verticals/DownloadClient/DummyDownloadService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/DummyDownloadService.cs @@ -11,7 +11,7 @@ namespace Infrastructure.Verticals.DownloadClient; public sealed class DummyDownloadService : DownloadServiceBase { - public DummyDownloadService(ILogger logger, IOptions queueCleanerConfig, FilenameEvaluator filenameEvaluator, Striker striker) : base(logger, queueCleanerConfig, filenameEvaluator, striker) + public DummyDownloadService(ILogger logger, IOptions queueCleanerConfig, IOptions contentBlockerConfig, FilenameEvaluator filenameEvaluator, Striker striker) : base(logger, queueCleanerConfig, contentBlockerConfig, filenameEvaluator, striker) { } diff --git a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs index 0f71766..706bc5e 100644 --- a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs @@ -22,9 +22,10 @@ public QBitService( IHttpClientFactory httpClientFactory, IOptions config, IOptions queueCleanerConfig, + IOptions contentBlockerConfig, FilenameEvaluator filenameEvaluator, Striker striker - ) : base(logger, queueCleanerConfig, filenameEvaluator, striker) + ) : base(logger, queueCleanerConfig, contentBlockerConfig, filenameEvaluator, striker) { _config = config.Value; _config.Validate(); @@ -116,7 +117,7 @@ ConcurrentBag regexes bool.TryParse(dictValue?.ToString(), out bool boolValue) && boolValue; - if (_queueCleanerConfig.StalledIgnorePrivate && isPrivate) + if (_contentBlockerConfig.IgnorePrivate && isPrivate) { // ignore private trackers _logger.LogDebug("skip files check | download is private | {name}", torrent.Name); diff --git a/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs b/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs index fe146d5..04c6f67 100644 --- a/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/Transmission/TransmissionService.cs @@ -25,9 +25,10 @@ public TransmissionService( ILogger logger, IOptions config, IOptions queueCleanerConfig, + IOptions contentBlockerConfig, FilenameEvaluator filenameEvaluator, Striker striker - ) : base(logger, queueCleanerConfig, filenameEvaluator, striker) + ) : base(logger, queueCleanerConfig, contentBlockerConfig, filenameEvaluator, striker) { _config = config.Value; _config.Validate(); @@ -95,7 +96,7 @@ ConcurrentBag regexes return false; } - if (_queueCleanerConfig.StalledIgnorePrivate && (torrent.IsPrivate ?? false)) + if (_contentBlockerConfig.IgnorePrivate && (torrent.IsPrivate ?? false)) { // ignore private trackers _logger.LogDebug("skip files check | download is private | {name}", torrent.Name);