mirror of
https://github.com/lidarr/Lidarr
synced 2025-01-03 05:25:10 +00: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.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,11 +103,21 @@ public DelugeTorrent[] GetTorrentsByLabel(string label, 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,
|
||||
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);
|
||||
|
||||
|
@ -114,11 +126,21 @@ public string AddTorrentFromMagnet(string magnetLink, 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,
|
||||
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);
|
||||
return response;
|
||||
|
|
|
@ -59,6 +59,12 @@ public DelugeSettings()
|
|||
[FieldDefinition(9, Label = "Add Paused", Type = FieldType.Checkbox)]
|
||||
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()
|
||||
{
|
||||
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.",
|
||||
"DownloadClientCheckNoneAvailableMessage": "No download client is available",
|
||||
"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.",
|
||||
"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+)",
|
||||
|
|
Loading…
Reference in a new issue