2020-07-08 14:40:08 +00:00
|
|
|
using NzbDrone.Common.Extensions;
|
2017-03-05 07:50:45 +00:00
|
|
|
using NzbDrone.Core.Indexers;
|
2020-07-08 14:40:08 +00:00
|
|
|
using NzbDrone.Core.Localization;
|
2019-06-14 03:54:25 +00:00
|
|
|
using NzbDrone.Core.ThingiProvider.Events;
|
2017-03-05 07:50:45 +00:00
|
|
|
|
|
|
|
namespace NzbDrone.Core.HealthCheck.Checks
|
|
|
|
{
|
2019-09-30 23:44:23 +00:00
|
|
|
[CheckOn(typeof(ProviderAddedEvent<IIndexer>))]
|
2019-06-14 03:54:25 +00:00
|
|
|
[CheckOn(typeof(ProviderUpdatedEvent<IIndexer>))]
|
|
|
|
[CheckOn(typeof(ProviderDeletedEvent<IIndexer>))]
|
|
|
|
[CheckOn(typeof(ProviderStatusChangedEvent<IIndexer>))]
|
2017-03-05 07:50:45 +00:00
|
|
|
public class IndexerRssCheck : HealthCheckBase
|
|
|
|
{
|
|
|
|
private readonly IIndexerFactory _indexerFactory;
|
|
|
|
|
2020-07-08 14:40:08 +00:00
|
|
|
public IndexerRssCheck(IIndexerFactory indexerFactory, ILocalizationService localizationService)
|
|
|
|
: base(localizationService)
|
2017-03-05 07:50:45 +00:00
|
|
|
{
|
|
|
|
_indexerFactory = indexerFactory;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override HealthCheck Check()
|
|
|
|
{
|
|
|
|
var enabled = _indexerFactory.RssEnabled(false);
|
|
|
|
|
|
|
|
if (enabled.Empty())
|
|
|
|
{
|
2021-06-05 19:26:09 +00:00
|
|
|
return new HealthCheck(GetType(), HealthCheckResult.Error, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoIndexers"), "#no-indexers-available-with-rss-sync-enabled-radarr-will-not-grab-new-releases-automatically");
|
2017-03-05 07:50:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var active = _indexerFactory.RssEnabled(true);
|
|
|
|
|
|
|
|
if (active.Empty())
|
|
|
|
{
|
2021-06-05 19:26:09 +00:00
|
|
|
return new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerRssHealthCheckNoAvailableIndexers"), "#indexers-are-unavailable-due-to-failures");
|
2017-03-05 07:50:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return new HealthCheck(GetType());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|