mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
New: Health check for indexers with invalid download client
(cherry picked from commit 377fce6fe15c0875c4bd33f1371a31af79c9310c) Closes #3959
This commit is contained in:
parent
1c4addddf3
commit
644123c5d3
2 changed files with 46 additions and 0 deletions
|
@ -0,0 +1,45 @@
|
||||||
|
using System.Linq;
|
||||||
|
using NzbDrone.Core.Download;
|
||||||
|
using NzbDrone.Core.Indexers;
|
||||||
|
using NzbDrone.Core.Localization;
|
||||||
|
using NzbDrone.Core.ThingiProvider.Events;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
|
{
|
||||||
|
[CheckOn(typeof(ProviderUpdatedEvent<IIndexer>))]
|
||||||
|
[CheckOn(typeof(ProviderDeletedEvent<IIndexer>))]
|
||||||
|
[CheckOn(typeof(ProviderUpdatedEvent<IDownloadClient>))]
|
||||||
|
[CheckOn(typeof(ProviderDeletedEvent<IDownloadClient>))]
|
||||||
|
public class IndexerDownloadClientCheck : HealthCheckBase
|
||||||
|
{
|
||||||
|
private readonly IIndexerFactory _indexerFactory;
|
||||||
|
private readonly IDownloadClientFactory _downloadClientFactory;
|
||||||
|
|
||||||
|
public IndexerDownloadClientCheck(IIndexerFactory indexerFactory,
|
||||||
|
IDownloadClientFactory downloadClientFactory,
|
||||||
|
ILocalizationService localizationService)
|
||||||
|
: base(localizationService)
|
||||||
|
{
|
||||||
|
_indexerFactory = indexerFactory;
|
||||||
|
_downloadClientFactory = downloadClientFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override HealthCheck Check()
|
||||||
|
{
|
||||||
|
var downloadClientsIds = _downloadClientFactory.All().Where(v => v.Enable).Select(v => v.Id).ToList();
|
||||||
|
var invalidIndexers = _indexerFactory.All()
|
||||||
|
.Where(v => v.Enable && v.DownloadClientId > 0 && !downloadClientsIds.Contains(v.DownloadClientId))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
if (invalidIndexers.Any())
|
||||||
|
{
|
||||||
|
return new HealthCheck(GetType(),
|
||||||
|
HealthCheckResult.Warning,
|
||||||
|
string.Format(_localizationService.GetLocalizedString("IndexerDownloadClientHealthCheckMessage"), string.Join(", ", invalidIndexers.Select(v => v.Name).ToArray())),
|
||||||
|
"#invalid-indexer-download-client-setting");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new HealthCheck(GetType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -432,6 +432,7 @@
|
||||||
"IncludeUnknownArtistItemsHelpText": "Show items without a artist in the queue, this could include removed artists, movies or anything else in Lidarr's category",
|
"IncludeUnknownArtistItemsHelpText": "Show items without a artist in the queue, this could include removed artists, movies or anything else in Lidarr's category",
|
||||||
"IncludeUnmonitored": "Include Unmonitored",
|
"IncludeUnmonitored": "Include Unmonitored",
|
||||||
"Indexer": "Indexer",
|
"Indexer": "Indexer",
|
||||||
|
"IndexerDownloadClientHealthCheckMessage": "Indexers with invalid download clients: {0}.",
|
||||||
"IndexerDownloadClientHelpText": "Specify which download client is used for grabs from this indexer",
|
"IndexerDownloadClientHelpText": "Specify which download client is used for grabs from this indexer",
|
||||||
"IndexerIdHelpText": "Specify what indexer the profile applies to",
|
"IndexerIdHelpText": "Specify what indexer the profile applies to",
|
||||||
"IndexerIdHelpTextWarning": "Using a specific indexer with preferred words can lead to duplicate releases being grabbed",
|
"IndexerIdHelpTextWarning": "Using a specific indexer with preferred words can lead to duplicate releases being grabbed",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue