mirror of
https://github.com/Cleanuparr/Cleanuparr.git
synced 2025-12-31 09:58:53 -05:00
31 lines
958 B
C#
31 lines
958 B
C#
using Cleanuparr.Domain.Entities.Deluge.Response;
|
|
using Cleanuparr.Infrastructure.Services;
|
|
using Infrastructure.Services;
|
|
|
|
namespace Cleanuparr.Infrastructure.Extensions;
|
|
|
|
public static class DelugeExtensions
|
|
{
|
|
public static bool ShouldIgnore(this DownloadStatus download, IReadOnlyList<string> ignoredDownloads)
|
|
{
|
|
foreach (string value in ignoredDownloads)
|
|
{
|
|
if (download.Hash?.Equals(value, StringComparison.InvariantCultureIgnoreCase) ?? false)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
if (download.Label?.Equals(value, StringComparison.InvariantCultureIgnoreCase) ?? false)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
if (download.Trackers.Any(x => UriService.GetDomain(x.Url)?.EndsWith(value, StringComparison.InvariantCultureIgnoreCase) ?? false))
|
|
{
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
} |