Compare commits

..

4 Commits

Author SHA1 Message Date
Marius Nechifor a6d3820104 Improve Transmission category detection (#62) 2025-02-17 02:48:27 +02:00
Flaminel 36c793a5fb updated chart values 2025-02-16 17:43:35 +02:00
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
5 changed files with 60 additions and 4 deletions
+26
View File
@@ -10,6 +10,9 @@ deployment:
repository: ghcr.io/flmorg/cleanuperr repository: ghcr.io/flmorg/cleanuperr
tag: latest tag: latest
env: env:
- name: DRY_RUN
value: "false"
- name: LOGGING__LOGLEVEL - name: LOGGING__LOGLEVEL
value: Debug value: Debug
- name: LOGGING__FILE__ENABLED - name: LOGGING__FILE__ENABLED
@@ -18,6 +21,7 @@ deployment:
value: /var/logs value: /var/logs
- name: LOGGING__ENHANCED - name: LOGGING__ENHANCED
value: "true" value: "true"
- name: TRIGGERS__QUEUECLEANER - name: TRIGGERS__QUEUECLEANER
value: 0 0/5 * * * ? value: 0 0/5 * * * ?
- name: TRIGGERS__CONTENTBLOCKER - name: TRIGGERS__CONTENTBLOCKER
@@ -47,6 +51,9 @@ deployment:
- name: CONTENTBLOCKER__DELETE_PRIVATE - name: CONTENTBLOCKER__DELETE_PRIVATE
value: "false" value: "false"
- name: DOWNLOADCLEANER__ENABLED
value: "false"
- name: DOWNLOAD_CLIENT - name: DOWNLOAD_CLIENT
value: qbittorrent value: qbittorrent
- name: QBITTORRENT__URL - name: QBITTORRENT__URL
@@ -75,6 +82,17 @@ deployment:
value: http://service.radarr-low-res.svc.cluster.local value: http://service.radarr-low-res.svc.cluster.local
- name: RADARR__INSTANCES__1__URL - name: RADARR__INSTANCES__1__URL
value: http://service.radarr-high-res.svc.cluster.local value: http://service.radarr-high-res.svc.cluster.local
- name: NOTIFIARR__ON_IMPORT_FAILED_STRIKE
value: "true"
- name: NOTIFIARR__ON_STALLED_STRIKE
value: "true"
- name: NOTIFIARR__ON_QUEUE_ITEM_DELETED
value: "true"
- name: NOTIFIARR__ON_DOWNLOAD_CLEANED
value: "true"
- name: NOTIFIARR__CHANNEL_ID
value: "1340708411259748413"
envFromSecret: envFromSecret:
- secretName: qbit-auth - secretName: qbit-auth
envs: envs:
@@ -94,6 +112,10 @@ deployment:
key: RDRL_API_KEY key: RDRL_API_KEY
- name: RADARR__INSTANCES__1__APIKEY - name: RADARR__INSTANCES__1__APIKEY
key: RDRH_API_KEY key: RDRH_API_KEY
- secretName: notifiarr-auth
envs:
- name: NOTIFIARR__API_KEY
key: API_KEY
resources: resources:
requests: requests:
cpu: 0m cpu: 0m
@@ -134,3 +156,7 @@ vaultSecrets:
templates: templates:
SNRL_API_KEY: "{% .Secrets.low_api_key %}" SNRL_API_KEY: "{% .Secrets.low_api_key %}"
SNRH_API_KEY: "{% .Secrets.high_api_key %}" SNRH_API_KEY: "{% .Secrets.high_api_key %}"
- name: notifiarr-auth
path: secrets/notifiarr
templates:
API_KEY: "{% .Secrets.passthrough_api_key %}"
@@ -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;
@@ -203,7 +203,16 @@ public class TransmissionService : DownloadService, ITransmissionService
?.Where(x => !string.IsNullOrEmpty(x.HashString)) ?.Where(x => !string.IsNullOrEmpty(x.HashString))
.Where(x => x.Status is 5 or 6) .Where(x => x.Status is 5 or 6)
.Where(x => categories .Where(x => categories
.Any(cat => x.DownloadDir?.EndsWith(cat.Name, StringComparison.InvariantCultureIgnoreCase) is true) .Any(cat =>
{
if (x.DownloadDir is null)
{
return false;
}
return Path.GetFileName(Path.TrimEndingDirectorySeparator(x.DownloadDir))
.Equals(cat.Name, StringComparison.InvariantCultureIgnoreCase);
})
) )
.Cast<object>() .Cast<object>()
.ToList(); .ToList();
@@ -220,7 +229,16 @@ public class TransmissionService : DownloadService, ITransmissionService
} }
Category? category = categoriesToClean Category? category = categoriesToClean
.FirstOrDefault(x => download.DownloadDir?.EndsWith(x.Name, StringComparison.InvariantCultureIgnoreCase) is true); .FirstOrDefault(x =>
{
if (download.DownloadDir is null)
{
return false;
}
return Path.GetFileName(Path.TrimEndingDirectorySeparator(download.DownloadDir))
.Equals(x.Name, StringComparison.InvariantCultureIgnoreCase);
});
if (category is null) if (category is null)
{ {
+1
View File
@@ -250,6 +250,7 @@ services:
# - NOTIFIARR__ON_IMPORT_FAILED_STRIKE=true # - NOTIFIARR__ON_IMPORT_FAILED_STRIKE=true
# - NOTIFIARR__ON_STALLED_STRIKE=true # - NOTIFIARR__ON_STALLED_STRIKE=true
# - NOTIFIARR__ON_QUEUE_ITEM_DELETED=true # - NOTIFIARR__ON_QUEUE_ITEM_DELETED=true
# - NOTIFIARR__ON_DOWNLOAD_CLEANED=true
# - NOTIFIARR__API_KEY=notifiarr_secret # - NOTIFIARR__API_KEY=notifiarr_secret
# - NOTIFIARR__CHANNEL_ID=discord_channel_id # - NOTIFIARR__CHANNEL_ID=discord_channel_id
volumes: volumes: