From 874351aed75e1f2bdf34b7a4da08615854f4e913 Mon Sep 17 00:00:00 2001 From: Flaminel Date: Wed, 26 Mar 2025 21:50:02 +0200 Subject: [PATCH] added dry run for category creation --- .../Verticals/DownloadClient/Deluge/DelugeService.cs | 8 +++++++- .../Verticals/DownloadClient/QBittorrent/QBitService.cs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs index 930e14d..d0d88e3 100644 --- a/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/Deluge/DelugeService.cs @@ -309,7 +309,7 @@ public class DelugeService : DownloadService, IDelugeService return; } - await _client.CreateLabel(name); + await _dryRunInterceptor.InterceptAsync(CreateLabel, name); } public override async Task ChangeCategoryForNoHardLinksAsync(List? downloads, HashSet excludedHashes, IReadOnlyList ignoredDownloads) @@ -402,6 +402,12 @@ public class DelugeService : DownloadService, IDelugeService await _client.DeleteTorrents([hash]); } + + [DryRunSafeguard] + protected async Task CreateLabel(string name) + { + await _client.CreateLabel(name); + } [DryRunSafeguard] protected virtual async Task ChangeFilesPriority(string hash, List sortedPriorities) diff --git a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs index 024a049..795b3ae 100644 --- a/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs +++ b/code/Infrastructure/Verticals/DownloadClient/QBittorrent/QBitService.cs @@ -348,7 +348,7 @@ public class QBitService : DownloadService, IQBitService return; } - await _client.AddCategoryAsync(name); + await _dryRunInterceptor.InterceptAsync(CreateCategory, name); } public override async Task ChangeCategoryForNoHardLinksAsync(List? downloads, HashSet excludedHashes, IReadOnlyList ignoredDownloads) @@ -446,6 +446,12 @@ public class QBitService : DownloadService, IQBitService { await _client.DeleteAsync(hash, deleteDownloadedData: true); } + + [DryRunSafeguard] + protected async Task CreateCategory(string name) + { + await _client.AddCategoryAsync(name); + } [DryRunSafeguard] protected virtual async Task SkipFile(string hash, int fileIndex)