diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs index 723c988cc..b60eff61d 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeProxy.cs @@ -1,11 +1,12 @@ using System; -using System.Net; -using System.Linq; using System.Collections.Generic; -using NzbDrone.Core.Rest; +using System.Linq; +using System.Net; +using Newtonsoft.Json.Linq; using NLog; +using NzbDrone.Common.Extensions; +using NzbDrone.Core.Rest; using RestSharp; -using Newtonsoft.Json.Linq; namespace NzbDrone.Core.Download.Clients.Deluge { @@ -231,10 +232,15 @@ namespace NzbDrone.Core.Download.Clients.Deluge { var protocol = settings.UseSsl ? "https" : "http"; - var url = String.Format(@"{0}://{1}:{2}", - protocol, - settings.Host, - settings.Port); + String url; + if (!settings.UrlBase.IsNullOrWhiteSpace()) + { + url = String.Format(@"{0}://{1}:{2}/{3}", protocol, settings.Host, settings.Port, settings.UrlBase.Trim('/')); + } + else + { + url = String.Format(@"{0}://{1}:{2}", protocol, settings.Host, settings.Port); + } var restClient = RestClientFactory.BuildClient(url); restClient.Timeout = 4000; diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs index 3f3412f02..12aedb38c 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs @@ -35,19 +35,22 @@ namespace NzbDrone.Core.Download.Clients.Deluge [FieldDefinition(1, Label = "Port", Type = FieldType.Textbox)] public Int32 Port { get; set; } - [FieldDefinition(2, Label = "Password", Type = FieldType.Password)] + [FieldDefinition(2, Label = "Url Base", Type = FieldType.Textbox, Advanced = true, HelpText = "Adds a prefix to the deluge json url, see http://[host]:[port]/[urlBase]/json")] + public String UrlBase { get; set; } + + [FieldDefinition(3, Label = "Password", Type = FieldType.Password)] public String Password { get; set; } - [FieldDefinition(3, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Sonarr avoids conflicts with unrelated downloads, but it's optional")] + [FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Sonarr avoids conflicts with unrelated downloads, but it's optional")] public String TvCategory { get; set; } - [FieldDefinition(4, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(DelugePriority), HelpText = "Priority to use when grabbing episodes that aired within the last 14 days")] + [FieldDefinition(5, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(DelugePriority), HelpText = "Priority to use when grabbing episodes that aired within the last 14 days")] public Int32 RecentTvPriority { get; set; } - [FieldDefinition(5, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(DelugePriority), HelpText = "Priority to use when grabbing episodes that aired over 14 days ago")] + [FieldDefinition(6, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(DelugePriority), HelpText = "Priority to use when grabbing episodes that aired over 14 days ago")] public Int32 OlderTvPriority { get; set; } - [FieldDefinition(6, Label = "Use SSL", Type = FieldType.Checkbox)] + [FieldDefinition(7, Label = "Use SSL", Type = FieldType.Checkbox)] public Boolean UseSsl { get; set; } public ValidationResult Validate()