Compare commits

..

2 Commits

Author SHA1 Message Date
Flaminel aade8a91c3 fixed dummy download service 2025-02-16 12:17:31 +02:00
Flaminel 3fe7c3de1a added null check for torrent properties 2025-02-16 03:37:50 +02:00
2 changed files with 12 additions and 1 deletions
@@ -12,8 +12,13 @@ using Microsoft.Extensions.Options;
namespace Infrastructure.Verticals.DownloadClient; namespace Infrastructure.Verticals.DownloadClient;
public sealed class DummyDownloadService : DownloadService public class DummyDownloadService : DownloadService
{ {
/// <inheritdoc/>
public DummyDownloadService()
{
}
public DummyDownloadService(ILogger<DownloadService> logger, IOptions<QueueCleanerConfig> queueCleanerConfig, IOptions<ContentBlockerConfig> contentBlockerConfig, IOptions<DownloadCleanerConfig> downloadCleanerConfig, IMemoryCache cache, IFilenameEvaluator filenameEvaluator, IStriker striker, NotificationPublisher notifier) : base(logger, queueCleanerConfig, contentBlockerConfig, downloadCleanerConfig, cache, filenameEvaluator, striker, notifier) public DummyDownloadService(ILogger<DownloadService> logger, IOptions<QueueCleanerConfig> queueCleanerConfig, IOptions<ContentBlockerConfig> contentBlockerConfig, IOptions<DownloadCleanerConfig> downloadCleanerConfig, IMemoryCache cache, IFilenameEvaluator filenameEvaluator, IStriker striker, NotificationPublisher notifier) : base(logger, queueCleanerConfig, contentBlockerConfig, downloadCleanerConfig, cache, filenameEvaluator, striker, notifier)
{ {
} }
@@ -245,6 +245,12 @@ public class QBitService : DownloadService, IQBitService
{ {
TorrentProperties? torrentProperties = await _client.GetTorrentPropertiesAsync(download.Hash); TorrentProperties? torrentProperties = await _client.GetTorrentPropertiesAsync(download.Hash);
if (torrentProperties is null)
{
_logger.LogDebug("failed to find torrent properties in the download client | {name}", download.Name);
return;
}
bool isPrivate = torrentProperties.AdditionalData.TryGetValue("is_private", out var dictValue) && bool isPrivate = torrentProperties.AdditionalData.TryGetValue("is_private", out var dictValue) &&
bool.TryParse(dictValue?.ToString(), out bool boolValue) bool.TryParse(dictValue?.ToString(), out bool boolValue)
&& boolValue; && boolValue;