match finalized sonarr commit

pull/9813/head
nopoz 7 months ago
parent 8a309ca7e1
commit 8b7e7514ef

@ -1,10 +1,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Dynamic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using NLog; using NLog;
using NzbDrone.Common.Cache; using NzbDrone.Common.Cache;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http; using NzbDrone.Common.Http;
using NzbDrone.Common.Serializer; using NzbDrone.Common.Serializer;
@ -101,14 +103,21 @@ namespace NzbDrone.Core.Download.Clients.Deluge
public string AddTorrentFromMagnet(string magnetLink, DelugeSettings settings) public string AddTorrentFromMagnet(string magnetLink, DelugeSettings settings)
{ {
var options = new dynamic options = new ExpandoObject();
options.add_paused = settings.AddPaused;
options.remove_at_ratio = false;
if (settings.DownloadDirectory.IsNotNullOrWhiteSpace())
{
options.download_location = settings.DownloadDirectory;
}
if (settings.CompletedDirectory.IsNotNullOrWhiteSpace())
{ {
download_location = settings.DownloadDirectory, options.move_completed_path = settings.CompletedDirectory;
move_completed_path = settings.CompletedDirectory, options.move_completed = true;
move_completed = settings.CompletedDirectory.IsNotNullOrWhiteSpace(), }
add_paused = settings.AddPaused,
remove_at_ratio = false
};
var response = ProcessRequest<string>(settings, "core.add_torrent_magnet", magnetLink, options); var response = ProcessRequest<string>(settings, "core.add_torrent_magnet", magnetLink, options);
@ -117,14 +126,21 @@ namespace NzbDrone.Core.Download.Clients.Deluge
public string AddTorrentFromFile(string filename, byte[] fileContent, DelugeSettings settings) public string AddTorrentFromFile(string filename, byte[] fileContent, DelugeSettings settings)
{ {
var options = new dynamic options = new ExpandoObject();
options.add_paused = settings.AddPaused;
options.remove_at_ratio = false;
if (settings.DownloadDirectory.IsNotNullOrWhiteSpace())
{
options.download_location = settings.DownloadDirectory;
}
if (settings.CompletedDirectory.IsNotNullOrWhiteSpace())
{ {
download_location = settings.DownloadDirectory, options.move_completed_path = settings.CompletedDirectory;
move_completed_path = settings.CompletedDirectory, options.move_completed = true;
move_completed = settings.CompletedDirectory.IsNotNullOrWhiteSpace(), }
add_paused = settings.AddPaused,
remove_at_ratio = false
};
var response = ProcessRequest<string>(settings, "core.add_torrent_file", filename, fileContent, options); var response = ProcessRequest<string>(settings, "core.add_torrent_file", filename, fileContent, options);

Loading…
Cancel
Save