mirror of
https://github.com/Radarr/Radarr.git
synced 2024-10-27 06:02:33 +01:00
Fixed: False Positives for RemotePath check with Deluge
This commit is contained in:
parent
9be8d438e7
commit
b888b044d6
@ -6,6 +6,7 @@
|
||||
using NzbDrone.Common.Disk;
|
||||
using NzbDrone.Common.EnsureThat;
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
using NzbDrone.Core.HealthCheck.Checks;
|
||||
@ -64,6 +65,10 @@ public void Setup()
|
||||
.Setup(s => s.GetDownloadClients())
|
||||
.Returns(new IDownloadClient[] { _downloadClient.Object });
|
||||
|
||||
Mocker.GetMock<IConfigService>()
|
||||
.Setup(s => s.EnableCompletedDownloadHandling)
|
||||
.Returns(true);
|
||||
|
||||
Mocker.GetMock<IDiskProvider>()
|
||||
.Setup(x => x.FolderExists(It.IsAny<string>()))
|
||||
.Returns((string path) =>
|
||||
|
@ -198,13 +198,22 @@ public override void RemoveItem(string downloadId, bool deleteData)
|
||||
public override DownloadClientInfo GetStatus()
|
||||
{
|
||||
var config = _proxy.GetConfig(Settings);
|
||||
var label = _proxy.GetLabelOptions(Settings);
|
||||
OsPath destDir;
|
||||
|
||||
var destDir = new OsPath(config.GetValueOrDefault("download_location") as string);
|
||||
|
||||
if (config.GetValueOrDefault("move_completed", false).ToString() == "True")
|
||||
if (label != null && label.ApplyMoveCompleted && label.MoveCompleted)
|
||||
{
|
||||
// if label exists and a label completed path exists and is enabled use it instead of global
|
||||
destDir = new OsPath(label.MoveCompletedPath);
|
||||
}
|
||||
else if (config.GetValueOrDefault("move_completed", false).ToString() == "True")
|
||||
{
|
||||
destDir = new OsPath(config.GetValueOrDefault("move_completed_path") as string);
|
||||
}
|
||||
else
|
||||
{
|
||||
destDir = new OsPath(config.GetValueOrDefault("download_location") as string);
|
||||
}
|
||||
|
||||
var status = new DownloadClientInfo
|
||||
{
|
||||
|
21
src/NzbDrone.Core/Download/Clients/Deluge/DelugeLabel.cs
Normal file
21
src/NzbDrone.Core/Download/Clients/Deluge/DelugeLabel.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NzbDrone.Core.Download.Clients.Deluge
|
||||
{
|
||||
public class DelugeLabel
|
||||
{
|
||||
[JsonProperty(PropertyName = "apply_move_completed")]
|
||||
public bool ApplyMoveCompleted { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "move_completed")]
|
||||
public bool MoveCompleted { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "move_completed_path")]
|
||||
public string MoveCompletedPath { get; set; }
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@ -19,6 +19,7 @@ public interface IDelugeProxy
|
||||
string[] GetAvailablePlugins(DelugeSettings settings);
|
||||
string[] GetEnabledPlugins(DelugeSettings settings);
|
||||
string[] GetAvailableLabels(DelugeSettings settings);
|
||||
DelugeLabel GetLabelOptions(DelugeSettings settings);
|
||||
void SetTorrentLabel(string hash, string label, DelugeSettings settings);
|
||||
void SetTorrentConfiguration(string hash, string key, object value, DelugeSettings settings);
|
||||
void SetTorrentSeedingConfiguration(string hash, TorrentSeedConfiguration seedConfiguration, DelugeSettings settings);
|
||||
@ -157,6 +158,13 @@ public string[] GetAvailableLabels(DelugeSettings settings)
|
||||
return response;
|
||||
}
|
||||
|
||||
public DelugeLabel GetLabelOptions(DelugeSettings settings)
|
||||
{
|
||||
var response = ProcessRequest<DelugeLabel>(settings, "label.get_options", settings.MovieCategory);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public void SetTorrentConfiguration(string hash, string key, object value, DelugeSettings settings)
|
||||
{
|
||||
var arguments = new Dictionary<string, object>();
|
||||
|
@ -5,6 +5,7 @@
|
||||
using NzbDrone.Common.EnvironmentInfo;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Messaging;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using NzbDrone.Core.Datastore.Events;
|
||||
using NzbDrone.Core.Download;
|
||||
using NzbDrone.Core.Download.Clients;
|
||||
@ -25,11 +26,13 @@ public class RemotePathMappingCheck : HealthCheckBase, IProvideHealthCheck
|
||||
{
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
private readonly IProvideDownloadClient _downloadClientProvider;
|
||||
private readonly IConfigService _configService;
|
||||
private readonly Logger _logger;
|
||||
private readonly IOsInfo _osInfo;
|
||||
|
||||
public RemotePathMappingCheck(IDiskProvider diskProvider,
|
||||
IProvideDownloadClient downloadClientProvider,
|
||||
IConfigService configService,
|
||||
IOsInfo osInfo,
|
||||
Logger logger,
|
||||
ILocalizationService localizationService)
|
||||
@ -37,12 +40,19 @@ public RemotePathMappingCheck(IDiskProvider diskProvider,
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
_downloadClientProvider = downloadClientProvider;
|
||||
_configService = configService;
|
||||
_logger = logger;
|
||||
_osInfo = osInfo;
|
||||
}
|
||||
|
||||
public override HealthCheck Check()
|
||||
{
|
||||
// We don't care about client folders if we are not handling completed files
|
||||
if (!_configService.EnableCompletedDownloadHandling)
|
||||
{
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
var clients = _downloadClientProvider.GetDownloadClients();
|
||||
|
||||
foreach (var client in clients)
|
||||
@ -104,6 +114,12 @@ public override HealthCheck Check()
|
||||
|
||||
public HealthCheck Check(IEvent message)
|
||||
{
|
||||
// We don't care about client folders if we are not handling completed files
|
||||
if (!_configService.EnableCompletedDownloadHandling)
|
||||
{
|
||||
return new HealthCheck(GetType());
|
||||
}
|
||||
|
||||
if (typeof(MovieImportFailedEvent).IsAssignableFrom(message.GetType()))
|
||||
{
|
||||
var failureMessage = (MovieImportFailedEvent)message;
|
||||
@ -118,13 +134,13 @@ public HealthCheck Check(IEvent message)
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the file doesn't exist but TrackInfo is not null then the message is coming from
|
||||
// ImportApprovedTracks and the file must have been removed part way through processing
|
||||
// If the file doesn't exist but MovieInfo is not null then the message is coming from
|
||||
// ImportApprovedMovies and the file must have been removed part way through processing
|
||||
return new HealthCheck(GetType(), HealthCheckResult.Error, $"File {moviePath} was removed part way though procesing.");
|
||||
}
|
||||
}
|
||||
|
||||
// If the previous case did not match then the failure occured in DownloadedTracksImportService,
|
||||
// If the previous case did not match then the failure occured in DownloadedMovieImportService,
|
||||
// while trying to locate the files reported by the download client
|
||||
var client = _downloadClientProvider.GetDownloadClients().FirstOrDefault(x => x.Definition.Name == failureMessage.DownloadClientInfo.Name);
|
||||
try
|
||||
|
Loading…
Reference in New Issue
Block a user