parent
20273b07ad
commit
07bd159436
|
@ -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);
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,12 @@ namespace NzbDrone.Core.Download.Clients.Deluge
|
||||||
[FieldDefinition(9, Label = "DownloadClientSettingsAddPaused", Type = FieldType.Checkbox)]
|
[FieldDefinition(9, Label = "DownloadClientSettingsAddPaused", 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));
|
||||||
|
|
|
@ -413,6 +413,10 @@
|
||||||
"DownloadClientDelugeValidationLabelPluginFailureDetail": "{appName} was unable to add the label to {clientName}.",
|
"DownloadClientDelugeValidationLabelPluginFailureDetail": "{appName} was unable to add the label to {clientName}.",
|
||||||
"DownloadClientDelugeValidationLabelPluginInactive": "Label plugin not activated",
|
"DownloadClientDelugeValidationLabelPluginInactive": "Label plugin not activated",
|
||||||
"DownloadClientDelugeValidationLabelPluginInactiveDetail": "You must have the Label plugin enabled in {clientName} to use categories.",
|
"DownloadClientDelugeValidationLabelPluginInactiveDetail": "You must have the Label plugin enabled in {clientName} to use categories.",
|
||||||
|
"DownloadClientDelugeSettingsDirectory": "Download Directory",
|
||||||
|
"DownloadClientDelugeSettingsDirectoryHelpText": "Optional location to put downloads in, leave blank to use the default Deluge location",
|
||||||
|
"DownloadClientDelugeSettingsDirectoryCompleted": "Move When Completed Directory",
|
||||||
|
"DownloadClientDelugeSettingsDirectoryCompletedHelpText": "Optional location to move completed downloads to, leave blank to use the default Deluge location",
|
||||||
"DownloadClientDownloadStationProviderMessage": "{appName} is unable to connect to Download Station if 2-Factor Authentication is enabled on your DSM account",
|
"DownloadClientDownloadStationProviderMessage": "{appName} is unable to connect to Download Station if 2-Factor Authentication is enabled on your DSM account",
|
||||||
"DownloadClientDownloadStationSettingsDirectoryHelpText": "Optional shared folder to put downloads into, leave blank to use the default Download Station location",
|
"DownloadClientDownloadStationSettingsDirectoryHelpText": "Optional shared folder to put downloads into, leave blank to use the default Download Station location",
|
||||||
"DownloadClientDownloadStationValidationApiVersion": "Download Station API version not supported, should be at least {requiredVersion}. It supports from {minVersion} to {maxVersion}",
|
"DownloadClientDownloadStationValidationApiVersion": "Download Station API version not supported, should be at least {requiredVersion}. It supports from {minVersion} to {maxVersion}",
|
||||||
|
|
Loading…
Reference in New Issue