match finalized sonarr commit

This commit is contained in:
nopoz 2024-03-02 21:46:09 -08:00
parent 8a309ca7e1
commit 8b7e7514ef
1 changed files with 30 additions and 14 deletions

View File

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