1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-28 02:27:13 +00:00

New: Added UrlBase to Deluge Settings to facilitate seedbox setups.

This commit is contained in:
Taloth Saldono 2015-03-08 15:37:33 +01:00
parent ebbaa403f6
commit 112cde1cee
2 changed files with 23 additions and 14 deletions

View file

@ -1,11 +1,12 @@
using System; using System;
using System.Net;
using System.Linq;
using System.Collections.Generic; using System.Collections.Generic;
using NzbDrone.Core.Rest; using System.Linq;
using NLog; using System.Net;
using RestSharp;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Rest;
using RestSharp;
namespace NzbDrone.Core.Download.Clients.Deluge namespace NzbDrone.Core.Download.Clients.Deluge
{ {
@ -231,10 +232,15 @@ private IRestClient BuildClient(DelugeSettings settings)
{ {
var protocol = settings.UseSsl ? "https" : "http"; var protocol = settings.UseSsl ? "https" : "http";
var url = String.Format(@"{0}://{1}:{2}", String url;
protocol, if (!settings.UrlBase.IsNullOrWhiteSpace())
settings.Host, {
settings.Port); 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); var restClient = RestClientFactory.BuildClient(url);
restClient.Timeout = 4000; restClient.Timeout = 4000;

View file

@ -35,19 +35,22 @@ public DelugeSettings()
[FieldDefinition(1, Label = "Port", Type = FieldType.Textbox)] [FieldDefinition(1, Label = "Port", Type = FieldType.Textbox)]
public Int32 Port { get; set; } 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; } 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; } 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; } 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; } 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 Boolean UseSsl { get; set; }
public ValidationResult Validate() public ValidationResult Validate()