mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04:00
New: Drone now uses the Download Client API to determine if a download is ready for import. (User configuration is required to replace the drone factory with this feature)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NzbDrone.Common;
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Download;
|
||||
|
||||
namespace NzbDrone.Core.HealthCheck.Checks
|
||||
{
|
||||
public class ImportMechanismCheck : HealthCheckBase
|
||||
{
|
||||
private readonly IConfigService _configService;
|
||||
private readonly IDownloadTrackingService _downloadTrackingService;
|
||||
|
||||
public ImportMechanismCheck(IConfigService configService, IDownloadTrackingService downloadTrackingService)
|
||||
{
|
||||
_configService = configService;
|
||||
_downloadTrackingService = downloadTrackingService;
|
||||
}
|
||||
|
||||
public override HealthCheck Check()
|
||||
{
|
||||
if (!_configService.IsDefined("EnableCompletedDownloadHandling"))
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Completed Download Handling is disabled");
|
||||
}
|
||||
|
||||
var droneFactoryFolder = _configService.DownloadedEpisodesFolder;
|
||||
|
||||
if (!_configService.EnableCompletedDownloadHandling && droneFactoryFolder.IsNullOrWhiteSpace())
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Enable Completed Download Handling or configure Drone factory");
|
||||
}
|
||||
|
||||
if (_configService.EnableCompletedDownloadHandling && !droneFactoryFolder.IsNullOrWhiteSpace() && _downloadTrackingService.GetCompletedDownloads().Any(v => droneFactoryFolder.PathEquals(v.DownloadItem.OutputPath) || droneFactoryFolder.IsParentPath(v.DownloadItem.OutputPath)))
|
||||
{
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Warning, "Download Client has history items in Drone Factory conflicting with Completed Download Handling");
|
||||
}
|
||||
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user