mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
New: Old/Obsolete Indexer Check
This commit is contained in:
@@ -0,0 +1,46 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using NLog;
|
||||||
|
using NzbDrone.Core.Indexers;
|
||||||
|
using NzbDrone.Core.Indexers.Cardigann;
|
||||||
|
using NzbDrone.Core.IndexerVersions;
|
||||||
|
using NzbDrone.Core.Localization;
|
||||||
|
using NzbDrone.Core.ThingiProvider.Events;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.HealthCheck.Checks
|
||||||
|
{
|
||||||
|
[CheckOn(typeof(ProviderDeletedEvent<IIndexer>))]
|
||||||
|
public class OutdatedDefinitionCheck : HealthCheckBase
|
||||||
|
{
|
||||||
|
private readonly IIndexerDefinitionUpdateService _indexerDefinitionUpdateService;
|
||||||
|
private readonly IIndexerFactory _indexerFactory;
|
||||||
|
private readonly Logger _logger;
|
||||||
|
|
||||||
|
public OutdatedDefinitionCheck(IIndexerDefinitionUpdateService indexerDefinitionUpdateService, IIndexerFactory indexerFactory, ILocalizationService localizationService, Logger logger)
|
||||||
|
: base(localizationService)
|
||||||
|
{
|
||||||
|
_indexerDefinitionUpdateService = indexerDefinitionUpdateService;
|
||||||
|
_indexerFactory = indexerFactory;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override HealthCheck Check()
|
||||||
|
{
|
||||||
|
var blacklist = _indexerDefinitionUpdateService.GetBlacklist();
|
||||||
|
|
||||||
|
var oldIndexers = _indexerFactory.All().Where(i => i.Implementation == "Cardigann" && blacklist.Contains(((CardigannSettings)i.Settings).DefinitionFile)).ToList();
|
||||||
|
|
||||||
|
if (oldIndexers.Count == 0)
|
||||||
|
{
|
||||||
|
return new HealthCheck(GetType());
|
||||||
|
}
|
||||||
|
|
||||||
|
return new HealthCheck(GetType(),
|
||||||
|
HealthCheckResult.Warning,
|
||||||
|
string.Format(_localizationService.GetLocalizedString("IndexerObsoleteCheckMessage"),
|
||||||
|
string.Join(", ", oldIndexers.Select(v => v.Name))),
|
||||||
|
"#indexers-are-obsolete");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CheckOnSchedule => false;
|
||||||
|
}
|
||||||
|
}
|
@@ -18,6 +18,7 @@ namespace NzbDrone.Core.IndexerVersions
|
|||||||
{
|
{
|
||||||
List<CardigannMetaDefinition> All();
|
List<CardigannMetaDefinition> All();
|
||||||
CardigannDefinition GetDefinition(string fileKey);
|
CardigannDefinition GetDefinition(string fileKey);
|
||||||
|
List<string> GetBlacklist();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IndexerDefinitionUpdateService : IIndexerDefinitionUpdateService, IExecute<IndexerDefinitionUpdateCommand>
|
public class IndexerDefinitionUpdateService : IIndexerDefinitionUpdateService, IExecute<IndexerDefinitionUpdateCommand>
|
||||||
@@ -79,6 +80,11 @@ namespace NzbDrone.Core.IndexerVersions
|
|||||||
return definition;
|
return definition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<string> GetBlacklist()
|
||||||
|
{
|
||||||
|
return _defintionBlacklist;
|
||||||
|
}
|
||||||
|
|
||||||
private CardigannDefinition GetHttpDefinition(string id)
|
private CardigannDefinition GetHttpDefinition(string id)
|
||||||
{
|
{
|
||||||
var req = new HttpRequest($"https://indexers.prowlarr.com/master/{DEFINITION_VERSION}/{id}");
|
var req = new HttpRequest($"https://indexers.prowlarr.com/master/{DEFINITION_VERSION}/{id}");
|
||||||
|
@@ -82,6 +82,7 @@
|
|||||||
"DevelopmentSettings": "Development Settings",
|
"DevelopmentSettings": "Development Settings",
|
||||||
"Disabled": "Disabled",
|
"Disabled": "Disabled",
|
||||||
"Docker": "Docker",
|
"Docker": "Docker",
|
||||||
|
"IndexerObsoleteCheckMessage": "Indexers are obsolete or have been updated: {0}. Please remove and (or) re-add to Prowlarr",
|
||||||
"DownloadClient": "Download Client",
|
"DownloadClient": "Download Client",
|
||||||
"DownloadClientCheckNoneAvailableMessage": "No download client is available",
|
"DownloadClientCheckNoneAvailableMessage": "No download client is available",
|
||||||
"DownloadClientCheckUnableToCommunicateMessage": "Unable to communicate with {0}.",
|
"DownloadClientCheckUnableToCommunicateMessage": "Unable to communicate with {0}.",
|
||||||
|
Reference in New Issue
Block a user