mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
New: Add download directory & move completed for Deluge
(cherry picked from commit 07bd159436935a7adb87ae1b6924a4d42d719b0f)
This commit is contained in:
parent
475590a21b
commit
cea5ee503f
3 changed files with 40 additions and 8 deletions
|
@ -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,11 +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())
|
||||||
{
|
{
|
||||||
add_paused = settings.AddPaused,
|
options.download_location = settings.DownloadDirectory;
|
||||||
remove_at_ratio = false
|
}
|
||||||
};
|
|
||||||
|
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);
|
var response = ProcessRequest<string>(settings, "core.add_torrent_magnet", magnetLink, options);
|
||||||
|
|
||||||
|
@ -114,11 +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())
|
||||||
{
|
{
|
||||||
add_paused = settings.AddPaused,
|
options.download_location = settings.DownloadDirectory;
|
||||||
remove_at_ratio = false
|
}
|
||||||
};
|
|
||||||
|
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);
|
var response = ProcessRequest<string>(settings, "core.add_torrent_file", filename, fileContent, options);
|
||||||
return response;
|
return response;
|
||||||
|
|
|
@ -59,6 +59,12 @@ namespace NzbDrone.Core.Download.Clients.Deluge
|
||||||
[FieldDefinition(9, Label = "Add Paused", Type = FieldType.Checkbox)]
|
[FieldDefinition(9, Label = "Add Paused", Type = FieldType.Checkbox)]
|
||||||
public bool AddPaused { get; set; }
|
public bool AddPaused { get; set; }
|
||||||
|
|
||||||
|
[FieldDefinition(10, Label = "DownloadClientDelugeSettingsDirectory", Type = FieldType.Textbox, Advanced = true, HelpText = "DownloadClientDelugeSettingsDirectoryHelpText")]
|
||||||
|
public string DownloadDirectory { get; set; }
|
||||||
|
|
||||||
|
[FieldDefinition(11, Label = "DownloadClientDelugeSettingsDirectoryCompleted", Type = FieldType.Textbox, Advanced = true, HelpText = "DownloadClientDelugeSettingsDirectoryCompletedHelpText")]
|
||||||
|
public string CompletedDirectory { get; set; }
|
||||||
|
|
||||||
public NzbDroneValidationResult Validate()
|
public NzbDroneValidationResult Validate()
|
||||||
{
|
{
|
||||||
return new NzbDroneValidationResult(Validator.Validate(this));
|
return new NzbDroneValidationResult(Validator.Validate(this));
|
||||||
|
|
|
@ -362,6 +362,10 @@
|
||||||
"DownloadClientCheckDownloadingToRoot": "Download client {0} places downloads in the root folder {1}. You should not download to a root folder.",
|
"DownloadClientCheckDownloadingToRoot": "Download client {0} places downloads in the root folder {1}. You should not download to a root folder.",
|
||||||
"DownloadClientCheckNoneAvailableMessage": "No download client is available",
|
"DownloadClientCheckNoneAvailableMessage": "No download client is available",
|
||||||
"DownloadClientCheckUnableToCommunicateMessage": "Unable to communicate with {0}.",
|
"DownloadClientCheckUnableToCommunicateMessage": "Unable to communicate with {0}.",
|
||||||
|
"DownloadClientDelugeSettingsDirectory": "Download Directory",
|
||||||
|
"DownloadClientDelugeSettingsDirectoryCompleted": "Move When Completed Directory",
|
||||||
|
"DownloadClientDelugeSettingsDirectoryCompletedHelpText": "Optional location to move completed downloads to, leave blank to use the default Deluge location",
|
||||||
|
"DownloadClientDelugeSettingsDirectoryHelpText": "Optional location to put downloads in, leave blank to use the default Deluge location",
|
||||||
"DownloadClientPriorityHelpText": "Download Client Priority from 1 (Highest) to 50 (Lowest). Default: 1. Round-Robin is used for clients with the same priority.",
|
"DownloadClientPriorityHelpText": "Download Client Priority from 1 (Highest) to 50 (Lowest). Default: 1. Round-Robin is used for clients with the same priority.",
|
||||||
"DownloadClientQbittorrentSettingsContentLayout": "Content Layout",
|
"DownloadClientQbittorrentSettingsContentLayout": "Content Layout",
|
||||||
"DownloadClientQbittorrentSettingsContentLayoutHelpText": "Whether to use qBittorrent's configured content layout, the original layout from the torrent or always create a subfolder (qBittorrent 4.3.2+)",
|
"DownloadClientQbittorrentSettingsContentLayoutHelpText": "Whether to use qBittorrent's configured content layout, the original layout from the torrent or always create a subfolder (qBittorrent 4.3.2+)",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue