Compare commits

..

4 Commits

Author SHA1 Message Date
Marius Nechifor b88ddde417 Fix content blocker env var usage (#44) 2025-01-18 16:23:34 +02:00
Flaminel 666c2656ec added svg logo 2025-01-17 22:11:05 +02:00
Marius Nechifor 7786776ed8 Fix logging template (#42) 2025-01-16 11:55:38 +02:00
Flaminel 2c60b38edf fixed README ports 2025-01-16 00:10:02 +02:00
8 changed files with 27 additions and 11 deletions
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 112 KiB

+2 -2
View File
@@ -221,13 +221,13 @@ services:
| RADARR__ENABLED | No | Enable or disable Radarr cleanup | false | | RADARR__ENABLED | No | Enable or disable Radarr cleanup | false |
| RADARR__BLOCK__TYPE | No | Block type<br>Can be `blacklist` or `whitelist` | `blacklist` | | RADARR__BLOCK__TYPE | No | Block type<br>Can be `blacklist` or `whitelist` | `blacklist` |
| RADARR__BLOCK__PATH | No | Path to the blocklist (local file or url)<br>Needs to be json compatible | empty | | RADARR__BLOCK__PATH | No | Path to the blocklist (local file or url)<br>Needs to be json compatible | empty |
| RADARR__INSTANCES__0__URL | No | First Radarr instance url | http://localhost:8989 | | RADARR__INSTANCES__0__URL | No | First Radarr instance url | http://localhost:7878 |
| RADARR__INSTANCES__0__APIKEY | No | First Radarr instance API key | empty | | RADARR__INSTANCES__0__APIKEY | No | First Radarr instance API key | empty |
||||| |||||
| LIDARR__ENABLED | No | Enable or disable LIDARR cleanup | false | | LIDARR__ENABLED | No | Enable or disable LIDARR cleanup | false |
| LIDARR__BLOCK__TYPE | No | Block type<br>Can be `blacklist` or `whitelist` | `blacklist` | | LIDARR__BLOCK__TYPE | No | Block type<br>Can be `blacklist` or `whitelist` | `blacklist` |
| LIDARR__BLOCK__PATH | No | Path to the blocklist (local file or url)<br>Needs to be json compatible | empty | | LIDARR__BLOCK__PATH | No | Path to the blocklist (local file or url)<br>Needs to be json compatible | empty |
| LIDARR__INSTANCES__0__URL | No | First LIDARR instance url | http://localhost:8989 | | LIDARR__INSTANCES__0__URL | No | First LIDARR instance url | http://localhost:8686 |
| LIDARR__INSTANCES__0__APIKEY | No | First LIDARR instance API key | empty | | LIDARR__INSTANCES__0__APIKEY | No | First LIDARR instance API key | empty |
</details> </details>
@@ -29,8 +29,8 @@ public static class LoggingDI
LoggerConfiguration logConfig = new(); LoggerConfiguration logConfig = new();
const string jobNameTemplate = "{#if JobName is not null} {Concat('[',JobName,']'),JOB_PAD}{#end}"; const string jobNameTemplate = "{#if JobName is not null} {Concat('[',JobName,']'),JOB_PAD}{#end}";
const string instanceNameTemplate = "{#if InstanceName is not null} {Concat('[',InstanceName,']'),ARR_PAD}"; const string instanceNameTemplate = "{#if InstanceName is not null} {Concat('[',InstanceName,']'),ARR_PAD}{#end}";
const string consoleOutputTemplate = $"[{{@t:yyyy-MM-dd HH:mm:ss.fff}} {{@l:u3}}]{jobNameTemplate}{instanceNameTemplate}{{#end}} {{@m}}\n{{@x}}"; const string consoleOutputTemplate = $"[{{@t:yyyy-MM-dd HH:mm:ss.fff}} {{@l:u3}}]{jobNameTemplate}{instanceNameTemplate} {{@m}}\n{{@x}}";
const string fileOutputTemplate = $"{{@t:yyyy-MM-dd HH:mm:ss.fff zzz}} [{{@l:u3}}]{jobNameTemplate}{instanceNameTemplate} {{@m:lj}}\n{{@x}}"; const string fileOutputTemplate = $"{{@t:yyyy-MM-dd HH:mm:ss.fff zzz}} [{{@l:u3}}]{jobNameTemplate}{instanceNameTemplate} {{@m:lj}}\n{{@x}}";
LogEventLevel level = LogEventLevel.Information; LogEventLevel level = LogEventLevel.Information;
List<string> names = [nameof(ContentBlocker), nameof(QueueCleaner)]; List<string> names = [nameof(ContentBlocker), nameof(QueueCleaner)];
@@ -20,9 +20,10 @@ public sealed class DelugeService : DownloadServiceBase
IOptions<DelugeConfig> config, IOptions<DelugeConfig> config,
IHttpClientFactory httpClientFactory, IHttpClientFactory httpClientFactory,
IOptions<QueueCleanerConfig> queueCleanerConfig, IOptions<QueueCleanerConfig> queueCleanerConfig,
IOptions<ContentBlockerConfig> contentBlockerConfig,
FilenameEvaluator filenameEvaluator, FilenameEvaluator filenameEvaluator,
Striker striker Striker striker
) : base(logger, queueCleanerConfig, filenameEvaluator, striker) ) : base(logger, queueCleanerConfig, contentBlockerConfig, filenameEvaluator, striker)
{ {
config.Value.Validate(); config.Value.Validate();
_client = new (config, httpClientFactory); _client = new (config, httpClientFactory);
@@ -92,7 +93,7 @@ public sealed class DelugeService : DownloadServiceBase
return false; return false;
} }
if (_queueCleanerConfig.StalledIgnorePrivate && status.Private) if (_contentBlockerConfig.IgnorePrivate && status.Private)
{ {
// ignore private trackers // ignore private trackers
_logger.LogDebug("skip files check | download is private | {name}", status.Name); _logger.LogDebug("skip files check | download is private | {name}", status.Name);
@@ -14,18 +14,21 @@ public abstract class DownloadServiceBase : IDownloadService
{ {
protected readonly ILogger<DownloadServiceBase> _logger; protected readonly ILogger<DownloadServiceBase> _logger;
protected readonly QueueCleanerConfig _queueCleanerConfig; protected readonly QueueCleanerConfig _queueCleanerConfig;
protected readonly ContentBlockerConfig _contentBlockerConfig;
protected readonly FilenameEvaluator _filenameEvaluator; protected readonly FilenameEvaluator _filenameEvaluator;
protected readonly Striker _striker; protected readonly Striker _striker;
protected DownloadServiceBase( protected DownloadServiceBase(
ILogger<DownloadServiceBase> logger, ILogger<DownloadServiceBase> logger,
IOptions<QueueCleanerConfig> queueCleanerConfig, IOptions<QueueCleanerConfig> queueCleanerConfig,
IOptions<ContentBlockerConfig> contentBlockerConfig,
FilenameEvaluator filenameEvaluator, FilenameEvaluator filenameEvaluator,
Striker striker Striker striker
) )
{ {
_logger = logger; _logger = logger;
_queueCleanerConfig = queueCleanerConfig.Value; _queueCleanerConfig = queueCleanerConfig.Value;
_contentBlockerConfig = contentBlockerConfig.Value;
_filenameEvaluator = filenameEvaluator; _filenameEvaluator = filenameEvaluator;
_striker = striker; _striker = striker;
} }
@@ -11,7 +11,7 @@ namespace Infrastructure.Verticals.DownloadClient;
public sealed class DummyDownloadService : DownloadServiceBase public sealed class DummyDownloadService : DownloadServiceBase
{ {
public DummyDownloadService(ILogger<DownloadServiceBase> logger, IOptions<QueueCleanerConfig> queueCleanerConfig, FilenameEvaluator filenameEvaluator, Striker striker) : base(logger, queueCleanerConfig, filenameEvaluator, striker) public DummyDownloadService(ILogger<DownloadServiceBase> logger, IOptions<QueueCleanerConfig> queueCleanerConfig, IOptions<ContentBlockerConfig> contentBlockerConfig, FilenameEvaluator filenameEvaluator, Striker striker) : base(logger, queueCleanerConfig, contentBlockerConfig, filenameEvaluator, striker)
{ {
} }
@@ -22,9 +22,10 @@ public sealed class QBitService : DownloadServiceBase
IHttpClientFactory httpClientFactory, IHttpClientFactory httpClientFactory,
IOptions<QBitConfig> config, IOptions<QBitConfig> config,
IOptions<QueueCleanerConfig> queueCleanerConfig, IOptions<QueueCleanerConfig> queueCleanerConfig,
IOptions<ContentBlockerConfig> contentBlockerConfig,
FilenameEvaluator filenameEvaluator, FilenameEvaluator filenameEvaluator,
Striker striker Striker striker
) : base(logger, queueCleanerConfig, filenameEvaluator, striker) ) : base(logger, queueCleanerConfig, contentBlockerConfig, filenameEvaluator, striker)
{ {
_config = config.Value; _config = config.Value;
_config.Validate(); _config.Validate();
@@ -116,7 +117,7 @@ public sealed class QBitService : DownloadServiceBase
bool.TryParse(dictValue?.ToString(), out bool boolValue) bool.TryParse(dictValue?.ToString(), out bool boolValue)
&& boolValue; && boolValue;
if (_queueCleanerConfig.StalledIgnorePrivate && isPrivate) if (_contentBlockerConfig.IgnorePrivate && isPrivate)
{ {
// ignore private trackers // ignore private trackers
_logger.LogDebug("skip files check | download is private | {name}", torrent.Name); _logger.LogDebug("skip files check | download is private | {name}", torrent.Name);
@@ -25,9 +25,10 @@ public sealed class TransmissionService : DownloadServiceBase
ILogger<TransmissionService> logger, ILogger<TransmissionService> logger,
IOptions<TransmissionConfig> config, IOptions<TransmissionConfig> config,
IOptions<QueueCleanerConfig> queueCleanerConfig, IOptions<QueueCleanerConfig> queueCleanerConfig,
IOptions<ContentBlockerConfig> contentBlockerConfig,
FilenameEvaluator filenameEvaluator, FilenameEvaluator filenameEvaluator,
Striker striker Striker striker
) : base(logger, queueCleanerConfig, filenameEvaluator, striker) ) : base(logger, queueCleanerConfig, contentBlockerConfig, filenameEvaluator, striker)
{ {
_config = config.Value; _config = config.Value;
_config.Validate(); _config.Validate();
@@ -95,7 +96,7 @@ public sealed class TransmissionService : DownloadServiceBase
return false; return false;
} }
if (_queueCleanerConfig.StalledIgnorePrivate && (torrent.IsPrivate ?? false)) if (_contentBlockerConfig.IgnorePrivate && (torrent.IsPrivate ?? false))
{ {
// ignore private trackers // ignore private trackers
_logger.LogDebug("skip files check | download is private | {name}", torrent.Name); _logger.LogDebug("skip files check | download is private | {name}", torrent.Name);