From ef8253044ef89ce63458895df8001a78dd4a8f90 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 29 Oct 2023 11:23:23 -0700 Subject: [PATCH] Fixed: Blocklisting torrents from indexers that do not provide torrent hash (cherry picked from commit 3541cd7ba877fb785c7f97123745abf51162eb8e) --- .../Blocklisting/BlocklistService.cs | 7 +++ .../Download/Clients/Aria2/Aria2.cs | 6 +-- .../Clients/Blackhole/ScanWatchFolder.cs | 4 +- .../Clients/Blackhole/TorrentBlackhole.cs | 5 ++- .../Clients/Blackhole/UsenetBlackhole.cs | 3 +- .../Download/Clients/Deluge/Deluge.cs | 6 +-- .../DownloadStation/TorrentDownloadStation.cs | 6 +-- .../DownloadStation/UsenetDownloadStation.cs | 4 +- .../Download/Clients/Flood/Flood.cs | 6 +-- .../FreeboxDownload/TorrentFreeboxDownload.cs | 20 ++++----- .../Download/Clients/Hadouken/Hadouken.cs | 6 +-- .../Download/Clients/NzbVortex/NzbVortex.cs | 4 +- .../Clients/NzbVortex/NzbVortexProxy.cs | 2 +- .../Download/Clients/Nzbget/Nzbget.cs | 4 +- .../Download/Clients/Pneumatic/Pneumatic.cs | 3 +- .../Clients/QBittorrent/QBittorrent.cs | 6 +-- .../Download/Clients/Sabnzbd/Sabnzbd.cs | 4 +- .../Clients/Transmission/Transmission.cs | 6 +-- .../Clients/Transmission/TransmissionBase.cs | 6 +-- .../Download/Clients/Vuze/Vuze.cs | 6 +-- .../Download/Clients/rTorrent/RTorrent.cs | 6 +-- .../Download/Clients/uTorrent/UTorrent.cs | 6 +-- .../Download/DownloadClientBase.cs | 4 -- src/NzbDrone.Core/Download/DownloadService.cs | 7 ++- .../Download/FailedDownloadService.cs | 2 +- .../Download/TorrentClientBase.cs | 45 ++++++++++++++++--- .../Download/UsenetClientBase.cs | 3 +- .../Exceptions/ReleaseBlockedException.cs | 28 ++++++++++++ .../Indexers/FileList/FileListSettings.cs | 3 ++ .../Indexers/HDBits/HDBitsSettings.cs | 3 ++ .../Indexers/IPTorrents/IPTorrentsSettings.cs | 3 ++ .../Indexers/ITorrentIndexerSettings.cs | 3 +- .../Indexers/Nyaa/NyaaSettings.cs | 3 ++ .../PassThePopcorn/PassThePopcornSettings.cs | 9 ++-- .../TorrentPotato/TorrentPotatoSettings.cs | 9 ++-- .../TorrentRss/TorrentRssIndexerSettings.cs | 9 ++-- .../Indexers/Torznab/TorznabSettings.cs | 3 ++ 37 files changed, 170 insertions(+), 90 deletions(-) create mode 100644 src/NzbDrone.Core/Exceptions/ReleaseBlockedException.cs diff --git a/src/NzbDrone.Core/Blocklisting/BlocklistService.cs b/src/NzbDrone.Core/Blocklisting/BlocklistService.cs index 8f2aec1a5..8956ac54a 100644 --- a/src/NzbDrone.Core/Blocklisting/BlocklistService.cs +++ b/src/NzbDrone.Core/Blocklisting/BlocklistService.cs @@ -15,6 +15,7 @@ namespace NzbDrone.Core.Blocklisting public interface IBlocklistService { bool Blocklisted(int movieId, ReleaseInfo release); + bool BlocklistedTorrentHash(int movieId, string hash); PagingSpec Paged(PagingSpec pagingSpec); List GetByMovieId(int movieId); void Block(RemoteMovie remoteMovie, string message); @@ -63,6 +64,12 @@ namespace NzbDrone.Core.Blocklisting .Any(b => SameNzb(b, release)); } + public bool BlocklistedTorrentHash(int movieId, string hash) + { + return _blocklistRepository.BlocklistedByTorrentInfoHash(movieId, hash).Any(b => + b.TorrentInfoHash.Equals(hash, StringComparison.InvariantCultureIgnoreCase)); + } + public PagingSpec Paged(PagingSpec pagingSpec) { return _blocklistRepository.GetPaged(pagingSpec); diff --git a/src/NzbDrone.Core/Download/Clients/Aria2/Aria2.cs b/src/NzbDrone.Core/Download/Clients/Aria2/Aria2.cs index 58cc3edfa..8c57fa2a5 100644 --- a/src/NzbDrone.Core/Download/Clients/Aria2/Aria2.cs +++ b/src/NzbDrone.Core/Download/Clients/Aria2/Aria2.cs @@ -7,9 +7,9 @@ using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.Validation; @@ -26,11 +26,11 @@ namespace NzbDrone.Core.Download.Clients.Aria2 ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, Logger logger) - : base(torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { _proxy = proxy; } diff --git a/src/NzbDrone.Core/Download/Clients/Blackhole/ScanWatchFolder.cs b/src/NzbDrone.Core/Download/Clients/Blackhole/ScanWatchFolder.cs index 53e2cfbb6..ef5bb0a0d 100644 --- a/src/NzbDrone.Core/Download/Clients/Blackhole/ScanWatchFolder.cs +++ b/src/NzbDrone.Core/Download/Clients/Blackhole/ScanWatchFolder.cs @@ -23,15 +23,13 @@ namespace NzbDrone.Core.Download.Clients.Blackhole private readonly Logger _logger; private readonly IDiskProvider _diskProvider; private readonly IDiskScanService _diskScanService; - private readonly INamingConfigService _namingConfigService; private readonly ICached> _watchFolderItemCache; - public ScanWatchFolder(ICacheManager cacheManager, IDiskScanService diskScanService, INamingConfigService namingConfigService, IDiskProvider diskProvider, Logger logger) + public ScanWatchFolder(ICacheManager cacheManager, IDiskScanService diskScanService, IDiskProvider diskProvider, Logger logger) { _logger = logger; _diskProvider = diskProvider; _diskScanService = diskScanService; - _namingConfigService = namingConfigService; _watchFolderItemCache = cacheManager.GetCache>(GetType()); } diff --git a/src/NzbDrone.Core/Download/Clients/Blackhole/TorrentBlackhole.cs b/src/NzbDrone.Core/Download/Clients/Blackhole/TorrentBlackhole.cs index 5ad0fcb3a..6e679c1c1 100644 --- a/src/NzbDrone.Core/Download/Clients/Blackhole/TorrentBlackhole.cs +++ b/src/NzbDrone.Core/Download/Clients/Blackhole/TorrentBlackhole.cs @@ -7,6 +7,7 @@ using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.MediaFiles.TorrentInfo; using NzbDrone.Core.Organizer; @@ -27,11 +28,11 @@ namespace NzbDrone.Core.Download.Clients.Blackhole ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, Logger logger) - : base(torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { _scanWatchFolder = scanWatchFolder; diff --git a/src/NzbDrone.Core/Download/Clients/Blackhole/UsenetBlackhole.cs b/src/NzbDrone.Core/Download/Clients/Blackhole/UsenetBlackhole.cs index 67b260b79..648842926 100644 --- a/src/NzbDrone.Core/Download/Clients/Blackhole/UsenetBlackhole.cs +++ b/src/NzbDrone.Core/Download/Clients/Blackhole/UsenetBlackhole.cs @@ -22,12 +22,11 @@ namespace NzbDrone.Core.Download.Clients.Blackhole public UsenetBlackhole(IScanWatchFolder scanWatchFolder, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, IValidateNzbs nzbValidationService, Logger logger) - : base(httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, nzbValidationService, logger) + : base(httpClient, configService, diskProvider, remotePathMappingService, nzbValidationService, logger) { _scanWatchFolder = scanWatchFolder; diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs index 2b8da9cbc..43412ad68 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs @@ -7,9 +7,9 @@ using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.Validation; @@ -24,11 +24,11 @@ namespace NzbDrone.Core.Download.Clients.Deluge ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, Logger logger) - : base(torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { _proxy = proxy; } diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs index 4d1d3854a..a3a76494c 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/TorrentDownloadStation.cs @@ -8,10 +8,10 @@ using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.Download.Clients.DownloadStation.Proxies; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.ThingiProvider; @@ -35,11 +35,11 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, Logger logger) - : base(torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { _dsInfoProxy = dsInfoProxy; _dsTaskProxySelector = dsTaskProxySelector; diff --git a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs index 4df2f7281..1bd571ab2 100644 --- a/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs +++ b/src/NzbDrone.Core/Download/Clients/DownloadStation/UsenetDownloadStation.cs @@ -9,7 +9,6 @@ using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; using NzbDrone.Core.Download.Clients.DownloadStation.Proxies; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.ThingiProvider; @@ -32,12 +31,11 @@ namespace NzbDrone.Core.Download.Clients.DownloadStation IDownloadStationTaskProxySelector dsTaskProxySelector, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, IValidateNzbs nzbValidationService, Logger logger) - : base(httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, nzbValidationService, logger) + : base(httpClient, configService, diskProvider, remotePathMappingService, nzbValidationService, logger) { _dsInfoProxy = dsInfoProxy; _dsTaskProxySelector = dsTaskProxySelector; diff --git a/src/NzbDrone.Core/Download/Clients/Flood/Flood.cs b/src/NzbDrone.Core/Download/Clients/Flood/Flood.cs index f3ed892b5..9b3993486 100644 --- a/src/NzbDrone.Core/Download/Clients/Flood/Flood.cs +++ b/src/NzbDrone.Core/Download/Clients/Flood/Flood.cs @@ -6,10 +6,10 @@ using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.Download.Clients.Flood.Models; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.ThingiProvider; @@ -26,11 +26,11 @@ namespace NzbDrone.Core.Download.Clients.Flood ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, Logger logger) - : base(torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { _proxy = proxy; _downloadSeedConfigProvider = downloadSeedConfigProvider; diff --git a/src/NzbDrone.Core/Download/Clients/FreeboxDownload/TorrentFreeboxDownload.cs b/src/NzbDrone.Core/Download/Clients/FreeboxDownload/TorrentFreeboxDownload.cs index 617b44c5d..42a935455 100644 --- a/src/NzbDrone.Core/Download/Clients/FreeboxDownload/TorrentFreeboxDownload.cs +++ b/src/NzbDrone.Core/Download/Clients/FreeboxDownload/TorrentFreeboxDownload.cs @@ -3,14 +3,13 @@ using System.Collections.Generic; using System.Linq; using FluentValidation.Results; using NLog; -using NzbDrone.Common.Cache; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.Download.Clients.FreeboxDownload.Responses; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; @@ -21,15 +20,14 @@ namespace NzbDrone.Core.Download.Clients.FreeboxDownload private readonly IFreeboxDownloadProxy _proxy; public TorrentFreeboxDownload(IFreeboxDownloadProxy proxy, - ITorrentFileInfoReader torrentFileInfoReader, - IHttpClient httpClient, - IConfigService configService, - INamingConfigService namingConfigService, - IDiskProvider diskProvider, - IRemotePathMappingService remotePathMappingService, - ICacheManager cacheManager, - Logger logger) - : base(torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + ITorrentFileInfoReader torrentFileInfoReader, + IHttpClient httpClient, + IConfigService configService, + IDiskProvider diskProvider, + IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, + Logger logger) + : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { _proxy = proxy; } diff --git a/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs b/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs index 28eb3b4f1..c0e73225b 100644 --- a/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs +++ b/src/NzbDrone.Core/Download/Clients/Hadouken/Hadouken.cs @@ -6,10 +6,10 @@ using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.Download.Clients.Hadouken.Models; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.Validation; @@ -24,11 +24,11 @@ namespace NzbDrone.Core.Download.Clients.Hadouken ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, Logger logger) - : base(torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { _proxy = proxy; } diff --git a/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortex.cs b/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortex.cs index 8c2f95dfe..536756f93 100644 --- a/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortex.cs +++ b/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortex.cs @@ -8,7 +8,6 @@ using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.Validation; @@ -22,12 +21,11 @@ namespace NzbDrone.Core.Download.Clients.NzbVortex public NzbVortex(INzbVortexProxy proxy, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, IValidateNzbs nzbValidationService, Logger logger) - : base(httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, nzbValidationService, logger) + : base(httpClient, configService, diskProvider, remotePathMappingService, nzbValidationService, logger) { _proxy = proxy; } diff --git a/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortexProxy.cs b/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortexProxy.cs index 3b7187a63..cec43775a 100644 --- a/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortexProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/NzbVortex/NzbVortexProxy.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Net; using Newtonsoft.Json; diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs index d1b5453d8..eea8b5be8 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs @@ -10,7 +10,6 @@ using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; using NzbDrone.Core.Exceptions; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.Validation; @@ -26,12 +25,11 @@ namespace NzbDrone.Core.Download.Clients.Nzbget public Nzbget(INzbgetProxy proxy, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, IValidateNzbs nzbValidationService, Logger logger) - : base(httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, nzbValidationService, logger) + : base(httpClient, configService, diskProvider, remotePathMappingService, nzbValidationService, logger) { _proxy = proxy; } diff --git a/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs b/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs index 003704b08..4c32d45a9 100644 --- a/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs +++ b/src/NzbDrone.Core/Download/Clients/Pneumatic/Pneumatic.cs @@ -21,11 +21,10 @@ namespace NzbDrone.Core.Download.Clients.Pneumatic public Pneumatic(IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, Logger logger) - : base(configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(configService, diskProvider, remotePathMappingService, logger) { _httpClient = httpClient; } diff --git a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs index c0705138e..285fc5a77 100644 --- a/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/QBittorrent/QBittorrent.cs @@ -8,9 +8,9 @@ using NzbDrone.Common.Cache; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.Validation; @@ -32,12 +32,12 @@ namespace NzbDrone.Core.Download.Clients.QBittorrent ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, ICacheManager cacheManager, + IBlocklistService blocklistService, Logger logger) - : base(torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { _proxySelector = proxySelector; diff --git a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs index c7b8e0d04..892cfbac4 100644 --- a/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs +++ b/src/NzbDrone.Core/Download/Clients/Sabnzbd/Sabnzbd.cs @@ -10,7 +10,6 @@ using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; using NzbDrone.Core.Exceptions; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.Validation; @@ -24,12 +23,11 @@ namespace NzbDrone.Core.Download.Clients.Sabnzbd public Sabnzbd(ISabnzbdProxy proxy, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, IValidateNzbs nzbValidationService, Logger logger) - : base(httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, nzbValidationService, logger) + : base(httpClient, configService, diskProvider, remotePathMappingService, nzbValidationService, logger) { _proxy = proxy; } diff --git a/src/NzbDrone.Core/Download/Clients/Transmission/Transmission.cs b/src/NzbDrone.Core/Download/Clients/Transmission/Transmission.cs index 38909b8a4..bf4dd8c29 100644 --- a/src/NzbDrone.Core/Download/Clients/Transmission/Transmission.cs +++ b/src/NzbDrone.Core/Download/Clients/Transmission/Transmission.cs @@ -4,9 +4,9 @@ using FluentValidation.Results; using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.RemotePathMappings; namespace NzbDrone.Core.Download.Clients.Transmission @@ -17,11 +17,11 @@ namespace NzbDrone.Core.Download.Clients.Transmission ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, Logger logger) - : base(proxy, torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(proxy, torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { } diff --git a/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs b/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs index 9419df077..0216a63c8 100644 --- a/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs +++ b/src/NzbDrone.Core/Download/Clients/Transmission/TransmissionBase.cs @@ -6,9 +6,9 @@ using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.Validation; @@ -23,11 +23,11 @@ namespace NzbDrone.Core.Download.Clients.Transmission ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, Logger logger) - : base(torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { _proxy = proxy; } diff --git a/src/NzbDrone.Core/Download/Clients/Vuze/Vuze.cs b/src/NzbDrone.Core/Download/Clients/Vuze/Vuze.cs index 0643ba26b..5ee5d6206 100644 --- a/src/NzbDrone.Core/Download/Clients/Vuze/Vuze.cs +++ b/src/NzbDrone.Core/Download/Clients/Vuze/Vuze.cs @@ -2,10 +2,10 @@ using FluentValidation.Results; using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.Download.Clients.Transmission; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.RemotePathMappings; namespace NzbDrone.Core.Download.Clients.Vuze @@ -18,11 +18,11 @@ namespace NzbDrone.Core.Download.Clients.Vuze ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, Logger logger) - : base(proxy, torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(proxy, torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { } diff --git a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs index f0ebbfb13..85214f872 100644 --- a/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/rTorrent/RTorrent.cs @@ -8,11 +8,11 @@ using NzbDrone.Common.Disk; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.Download.Clients.rTorrent; using NzbDrone.Core.Exceptions; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.ThingiProvider; @@ -31,13 +31,13 @@ namespace NzbDrone.Core.Download.Clients.RTorrent ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, IDownloadSeedConfigProvider downloadSeedConfigProvider, IRTorrentDirectoryValidator rTorrentDirectoryValidator, + IBlocklistService blocklistService, Logger logger) - : base(torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { _proxy = proxy; _rTorrentDirectoryValidator = rTorrentDirectoryValidator; diff --git a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs index c5e581254..5a8679109 100644 --- a/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs +++ b/src/NzbDrone.Core/Download/Clients/uTorrent/UTorrent.cs @@ -8,9 +8,9 @@ using NzbDrone.Common.Cache; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.MediaFiles.TorrentInfo; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.Validation; @@ -27,11 +27,11 @@ namespace NzbDrone.Core.Download.Clients.UTorrent ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, Logger logger) - : base(torrentFileInfoReader, httpClient, configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(torrentFileInfoReader, httpClient, configService, diskProvider, remotePathMappingService, blocklistService, logger) { _proxy = proxy; diff --git a/src/NzbDrone.Core/Download/DownloadClientBase.cs b/src/NzbDrone.Core/Download/DownloadClientBase.cs index 1360213f8..bb8f7aa92 100644 --- a/src/NzbDrone.Core/Download/DownloadClientBase.cs +++ b/src/NzbDrone.Core/Download/DownloadClientBase.cs @@ -8,7 +8,6 @@ using NzbDrone.Common.Disk; using NzbDrone.Common.Http; using NzbDrone.Core.Configuration; using NzbDrone.Core.Indexers; -using NzbDrone.Core.Organizer; using NzbDrone.Core.Parser.Model; using NzbDrone.Core.RemotePathMappings; using NzbDrone.Core.ThingiProvider; @@ -22,7 +21,6 @@ namespace NzbDrone.Core.Download where TSettings : IProviderConfig, new() { protected readonly IConfigService _configService; - protected readonly INamingConfigService _namingConfigService; protected readonly IDiskProvider _diskProvider; protected readonly IRemotePathMappingService _remotePathMappingService; protected readonly Logger _logger; @@ -76,13 +74,11 @@ namespace NzbDrone.Core.Download protected TSettings Settings => (TSettings)Definition.Settings; protected DownloadClientBase(IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, Logger logger) { _configService = configService; - _namingConfigService = namingConfigService; _diskProvider = diskProvider; _remotePathMappingService = remotePathMappingService; _logger = logger; diff --git a/src/NzbDrone.Core/Download/DownloadService.cs b/src/NzbDrone.Core/Download/DownloadService.cs index eec9aa857..e9741f430 100644 --- a/src/NzbDrone.Core/Download/DownloadService.cs +++ b/src/NzbDrone.Core/Download/DownloadService.cs @@ -103,6 +103,11 @@ namespace NzbDrone.Core.Download _logger.Trace("Release {0} no longer available on indexer.", remoteMovie); throw; } + catch (ReleaseBlockedException) + { + _logger.Trace("Release {0} previously added to blocklist, not sending to download client again.", remoteMovie); + throw; + } catch (DownloadClientRejectedReleaseException) { _logger.Trace("Release {0} rejected by download client, possible duplicate.", remoteMovie); @@ -127,7 +132,7 @@ namespace NzbDrone.Core.Download movieGrabbedEvent.DownloadClientId = downloadClient.Definition.Id; movieGrabbedEvent.DownloadClientName = downloadClient.Definition.Name; - if (!string.IsNullOrWhiteSpace(downloadClientId)) + if (downloadClientId.IsNotNullOrWhiteSpace()) { movieGrabbedEvent.DownloadId = downloadClientId; } diff --git a/src/NzbDrone.Core/Download/FailedDownloadService.cs b/src/NzbDrone.Core/Download/FailedDownloadService.cs index cdd8e8dbe..c78c209bc 100644 --- a/src/NzbDrone.Core/Download/FailedDownloadService.cs +++ b/src/NzbDrone.Core/Download/FailedDownloadService.cs @@ -129,7 +129,7 @@ namespace NzbDrone.Core.Download private void PublishDownloadFailedEvent(List historyItems, string message, TrackedDownload trackedDownload = null, bool skipRedownload = false) { - var historyItem = historyItems.First(); + var historyItem = historyItems.Last(); Enum.TryParse(historyItem.Data.GetValueOrDefault(MovieHistory.RELEASE_SOURCE, ReleaseSourceType.Unknown.ToString()), out ReleaseSourceType releaseSource); var downloadFailedEvent = new DownloadFailedEvent diff --git a/src/NzbDrone.Core/Download/TorrentClientBase.cs b/src/NzbDrone.Core/Download/TorrentClientBase.cs index 2ac9194bf..69bafd1b3 100644 --- a/src/NzbDrone.Core/Download/TorrentClientBase.cs +++ b/src/NzbDrone.Core/Download/TorrentClientBase.cs @@ -6,6 +6,7 @@ using NLog; using NzbDrone.Common.Disk; using NzbDrone.Common.Extensions; using NzbDrone.Common.Http; +using NzbDrone.Core.Blocklisting; using NzbDrone.Core.Configuration; using NzbDrone.Core.Exceptions; using NzbDrone.Core.Indexers; @@ -21,18 +22,20 @@ namespace NzbDrone.Core.Download where TSettings : IProviderConfig, new() { protected readonly IHttpClient _httpClient; + private readonly IBlocklistService _blocklistService; protected readonly ITorrentFileInfoReader _torrentFileInfoReader; protected TorrentClientBase(ITorrentFileInfoReader torrentFileInfoReader, IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, + IBlocklistService blocklistService, Logger logger) - : base(configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(configService, diskProvider, remotePathMappingService, logger) { _httpClient = httpClient; + _blocklistService = blocklistService; _torrentFileInfoReader = torrentFileInfoReader; } @@ -87,7 +90,7 @@ namespace NzbDrone.Core.Download { try { - return DownloadFromMagnetUrl(remoteMovie, magnetUrl); + return DownloadFromMagnetUrl(remoteMovie, indexer, magnetUrl); } catch (NotSupportedException ex) { @@ -101,7 +104,7 @@ namespace NzbDrone.Core.Download { try { - return DownloadFromMagnetUrl(remoteMovie, magnetUrl); + return DownloadFromMagnetUrl(remoteMovie, indexer, magnetUrl); } catch (NotSupportedException ex) { @@ -150,7 +153,7 @@ namespace NzbDrone.Core.Download { if (locationHeader.StartsWith("magnet:")) { - return DownloadFromMagnetUrl(remoteMovie, locationHeader); + return DownloadFromMagnetUrl(remoteMovie, indexer, locationHeader); } request.Url += new HttpUri(locationHeader); @@ -193,6 +196,9 @@ namespace NzbDrone.Core.Download var filename = string.Format("{0}.torrent", FileNameBuilder.CleanFileName(remoteMovie.Release.Title)); var hash = _torrentFileInfoReader.GetHashFromTorrentFile(torrentFile); + + EnsureReleaseIsNotBlocklisted(remoteMovie, indexer, hash); + var actualHash = AddFromTorrentFile(remoteMovie, hash, filename, torrentFile); if (actualHash.IsNotNullOrWhiteSpace() && hash != actualHash) @@ -206,7 +212,7 @@ namespace NzbDrone.Core.Download return actualHash; } - private string DownloadFromMagnetUrl(RemoteMovie remoteMovie, string magnetUrl) + private string DownloadFromMagnetUrl(RemoteMovie remoteMovie, IIndexer indexer, string magnetUrl) { string hash = null; string actualHash = null; @@ -224,6 +230,8 @@ namespace NzbDrone.Core.Download if (hash != null) { + EnsureReleaseIsNotBlocklisted(remoteMovie, indexer, hash); + actualHash = AddFromMagnetLink(remoteMovie, hash, magnetUrl); } @@ -237,5 +245,30 @@ namespace NzbDrone.Core.Download return actualHash; } + + private void EnsureReleaseIsNotBlocklisted(RemoteMovie remoteMovie, IIndexer indexer, string hash) + { + var indexerSettings = indexer?.Definition?.Settings as ITorrentIndexerSettings; + var torrentInfo = remoteMovie.Release as TorrentInfo; + var torrentInfoHash = torrentInfo?.InfoHash; + + // If the release didn't come from an interactive search, + // the hash wasn't known during processing and the + // indexer is configured to reject blocklisted releases + // during grab check if it's already been blocklisted. + + if (torrentInfo != null && torrentInfoHash.IsNullOrWhiteSpace()) + { + // If the hash isn't known from parsing we set it here so it can be used for blocklisting. + torrentInfo.InfoHash = hash; + + if (remoteMovie.ReleaseSource != ReleaseSourceType.InteractiveSearch && + indexerSettings?.RejectBlocklistedTorrentHashesWhileGrabbing == true && + _blocklistService.BlocklistedTorrentHash(remoteMovie.Movie.Id, hash)) + { + throw new ReleaseBlockedException(remoteMovie.Release, "Release previously added to blocklist"); + } + } + } } } diff --git a/src/NzbDrone.Core/Download/UsenetClientBase.cs b/src/NzbDrone.Core/Download/UsenetClientBase.cs index 36849135b..2f737828b 100644 --- a/src/NzbDrone.Core/Download/UsenetClientBase.cs +++ b/src/NzbDrone.Core/Download/UsenetClientBase.cs @@ -21,12 +21,11 @@ namespace NzbDrone.Core.Download protected UsenetClientBase(IHttpClient httpClient, IConfigService configService, - INamingConfigService namingConfigService, IDiskProvider diskProvider, IRemotePathMappingService remotePathMappingService, IValidateNzbs nzbValidationService, Logger logger) - : base(configService, namingConfigService, diskProvider, remotePathMappingService, logger) + : base(configService, diskProvider, remotePathMappingService, logger) { _httpClient = httpClient; _nzbValidationService = nzbValidationService; diff --git a/src/NzbDrone.Core/Exceptions/ReleaseBlockedException.cs b/src/NzbDrone.Core/Exceptions/ReleaseBlockedException.cs new file mode 100644 index 000000000..73d8b8f8d --- /dev/null +++ b/src/NzbDrone.Core/Exceptions/ReleaseBlockedException.cs @@ -0,0 +1,28 @@ +using System; +using NzbDrone.Core.Parser.Model; + +namespace NzbDrone.Core.Exceptions +{ + public class ReleaseBlockedException : ReleaseDownloadException + { + public ReleaseBlockedException(ReleaseInfo release, string message, params object[] args) + : base(release, message, args) + { + } + + public ReleaseBlockedException(ReleaseInfo release, string message) + : base(release, message) + { + } + + public ReleaseBlockedException(ReleaseInfo release, string message, Exception innerException, params object[] args) + : base(release, message, innerException, args) + { + } + + public ReleaseBlockedException(ReleaseInfo release, string message, Exception innerException) + : base(release, message, innerException) + { + } + } +} diff --git a/src/NzbDrone.Core/Indexers/FileList/FileListSettings.cs b/src/NzbDrone.Core/Indexers/FileList/FileListSettings.cs index 77e9d49c0..e3e22f891 100644 --- a/src/NzbDrone.Core/Indexers/FileList/FileListSettings.cs +++ b/src/NzbDrone.Core/Indexers/FileList/FileListSettings.cs @@ -64,6 +64,9 @@ namespace NzbDrone.Core.Indexers.FileList [FieldDefinition(7)] public SeedCriteriaSettings SeedCriteria { get; set; } = new SeedCriteriaSettings(); + [FieldDefinition(8, Type = FieldType.Checkbox, Label = "Reject Blocklisted Torrent Hashes While Grabbing", HelpText = "If a torrent is blocked by hash it may not properly be rejected during RSS/Search for some indexers, enabling this will allow it to be rejected after the torrent is grabbed, but before it is sent to the client.", Advanced = true)] + public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this)); diff --git a/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs b/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs index 0824b5b72..2797492d6 100644 --- a/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs +++ b/src/NzbDrone.Core/Indexers/HDBits/HDBitsSettings.cs @@ -65,6 +65,9 @@ namespace NzbDrone.Core.Indexers.HDBits [FieldDefinition(9)] public SeedCriteriaSettings SeedCriteria { get; set; } = new (); + [FieldDefinition(10, Type = FieldType.Checkbox, Label = "Reject Blocklisted Torrent Hashes While Grabbing", HelpText = "If a torrent is blocked by hash it may not properly be rejected during RSS/Search for some indexers, enabling this will allow it to be rejected after the torrent is grabbed, but before it is sent to the client.", Advanced = true)] + public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this)); diff --git a/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs b/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs index 678dd66c4..7b2740832 100644 --- a/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs +++ b/src/NzbDrone.Core/Indexers/IPTorrents/IPTorrentsSettings.cs @@ -53,6 +53,9 @@ namespace NzbDrone.Core.Indexers.IPTorrents [FieldDefinition(4)] public SeedCriteriaSettings SeedCriteria { get; set; } = new SeedCriteriaSettings(); + [FieldDefinition(5, Type = FieldType.Checkbox, Label = "Reject Blocklisted Torrent Hashes While Grabbing", HelpText = "If a torrent is blocked by hash it may not properly be rejected during RSS/Search for some indexers, enabling this will allow it to be rejected after the torrent is grabbed, but before it is sent to the client.", Advanced = true)] + public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this)); diff --git a/src/NzbDrone.Core/Indexers/ITorrentIndexerSettings.cs b/src/NzbDrone.Core/Indexers/ITorrentIndexerSettings.cs index 7fa23251e..31b914416 100644 --- a/src/NzbDrone.Core/Indexers/ITorrentIndexerSettings.cs +++ b/src/NzbDrone.Core/Indexers/ITorrentIndexerSettings.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; namespace NzbDrone.Core.Indexers { @@ -9,5 +9,6 @@ namespace NzbDrone.Core.Indexers // TODO: System.Text.Json requires setter be public for sub-object deserialization in 3.0. https://github.com/dotnet/corefx/issues/42515 SeedCriteriaSettings SeedCriteria { get; set; } + bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; } } } diff --git a/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs b/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs index ae1f4c68f..e1f443e55 100644 --- a/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs +++ b/src/NzbDrone.Core/Indexers/Nyaa/NyaaSettings.cs @@ -51,6 +51,9 @@ namespace NzbDrone.Core.Indexers.Nyaa [FieldDefinition(5)] public SeedCriteriaSettings SeedCriteria { get; set; } = new SeedCriteriaSettings(); + [FieldDefinition(6, Type = FieldType.Checkbox, Label = "Reject Blocklisted Torrent Hashes While Grabbing", HelpText = "If a torrent is blocked by hash it may not properly be rejected during RSS/Search for some indexers, enabling this will allow it to be rejected after the torrent is grabbed, but before it is sent to the client.", Advanced = true)] + public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this)); diff --git a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornSettings.cs b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornSettings.cs index ba6d4ab77..e67207351 100644 --- a/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornSettings.cs +++ b/src/NzbDrone.Core/Indexers/PassThePopcorn/PassThePopcornSettings.cs @@ -47,11 +47,14 @@ namespace NzbDrone.Core.Indexers.PassThePopcorn [FieldDefinition(4, Type = FieldType.Textbox, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)] public int MinimumSeeders { get; set; } - [FieldDefinition(5)] + [FieldDefinition(5, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)] + public IEnumerable RequiredFlags { get; set; } + + [FieldDefinition(6)] public SeedCriteriaSettings SeedCriteria { get; set; } = new SeedCriteriaSettings(); - [FieldDefinition(6, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)] - public IEnumerable RequiredFlags { get; set; } + [FieldDefinition(7, Type = FieldType.Checkbox, Label = "Reject Blocklisted Torrent Hashes While Grabbing", HelpText = "If a torrent is blocked by hash it may not properly be rejected during RSS/Search for some indexers, enabling this will allow it to be rejected after the torrent is grabbed, but before it is sent to the client.", Advanced = true)] + public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; } public NzbDroneValidationResult Validate() { diff --git a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoSettings.cs b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoSettings.cs index b324025f7..63edde307 100644 --- a/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoSettings.cs +++ b/src/NzbDrone.Core/Indexers/TorrentPotato/TorrentPotatoSettings.cs @@ -45,11 +45,14 @@ namespace NzbDrone.Core.Indexers.TorrentPotato [FieldDefinition(4, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)] public int MinimumSeeders { get; set; } - [FieldDefinition(5)] + [FieldDefinition(5, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", Advanced = true)] + public IEnumerable RequiredFlags { get; set; } + + [FieldDefinition(6)] public SeedCriteriaSettings SeedCriteria { get; set; } = new SeedCriteriaSettings(); - [FieldDefinition(6, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", Advanced = true)] - public IEnumerable RequiredFlags { get; set; } + [FieldDefinition(7, Type = FieldType.Checkbox, Label = "Reject Blocklisted Torrent Hashes While Grabbing", HelpText = "If a torrent is blocked by hash it may not properly be rejected during RSS/Search for some indexers, enabling this will allow it to be rejected after the torrent is grabbed, but before it is sent to the client.", Advanced = true)] + public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; } public NzbDroneValidationResult Validate() { diff --git a/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssIndexerSettings.cs b/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssIndexerSettings.cs index d54010083..f4e2c39ca 100644 --- a/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssIndexerSettings.cs +++ b/src/NzbDrone.Core/Indexers/TorrentRss/TorrentRssIndexerSettings.cs @@ -46,11 +46,14 @@ namespace NzbDrone.Core.Indexers.TorrentRss [FieldDefinition(4, Type = FieldType.Number, Label = "Minimum Seeders", HelpText = "Minimum number of seeders required.", Advanced = true)] public int MinimumSeeders { get; set; } - [FieldDefinition(5)] + [FieldDefinition(5, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)] + public IEnumerable RequiredFlags { get; set; } + + [FieldDefinition(6)] public SeedCriteriaSettings SeedCriteria { get; set; } = new SeedCriteriaSettings(); - [FieldDefinition(6, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)] - public IEnumerable RequiredFlags { get; set; } + [FieldDefinition(7, Type = FieldType.Checkbox, Label = "Reject Blocklisted Torrent Hashes While Grabbing", HelpText = "If a torrent is blocked by hash it may not properly be rejected during RSS/Search for some indexers, enabling this will allow it to be rejected after the torrent is grabbed, but before it is sent to the client.", Advanced = true)] + public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; } public NzbDroneValidationResult Validate() { diff --git a/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs b/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs index 48a9179dc..c5524636f 100644 --- a/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs +++ b/src/NzbDrone.Core/Indexers/Torznab/TorznabSettings.cs @@ -61,6 +61,9 @@ namespace NzbDrone.Core.Indexers.Torznab [FieldDefinition(10, Type = FieldType.Select, SelectOptions = typeof(IndexerFlags), Label = "Required Flags", HelpText = "What indexer flags are required?", HelpLink = "https://wiki.servarr.com/radarr/settings#indexer-flags", Advanced = true)] public IEnumerable RequiredFlags { get; set; } + [FieldDefinition(11, Type = FieldType.Checkbox, Label = "Reject Blocklisted Torrent Hashes While Grabbing", HelpText = "If a torrent is blocked by hash it may not properly be rejected during RSS/Search for some indexers, enabling this will allow it to be rejected after the torrent is grabbed, but before it is sent to the client.", Advanced = true)] + public bool RejectBlocklistedTorrentHashesWhileGrabbing { get; set; } + public override NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this));