mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2025-12-27 16:08:08 -05:00
51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using Cleanuparr.Infrastructure.Services;
|
|
using Infrastructure.Services;
|
|
using QBittorrent.Client;
|
|
|
|
namespace Cleanuparr.Infrastructure.Extensions;
|
|
|
|
public static class QBitExtensions
|
|
{
|
|
public static bool ShouldIgnore(this TorrentInfo download, IReadOnlyList<string> ignoredDownloads)
|
|
{
|
|
foreach (string value in ignoredDownloads)
|
|
{
|
|
if (download.Hash.Equals(value, StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
if (download.Category.Equals(value, StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
if (download.Tags.Contains(value, StringComparer.InvariantCultureIgnoreCase))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public static bool ShouldIgnore(this TorrentTracker tracker, IReadOnlyList<string> ignoredDownloads)
|
|
{
|
|
string? trackerUrl = UriService.GetDomain(tracker.Url);
|
|
|
|
if (trackerUrl is null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
foreach (string value in ignoredDownloads)
|
|
{
|
|
if (trackerUrl.EndsWith(value, StringComparison.InvariantCultureIgnoreCase))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
} |