1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02: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.Net;
using System.Linq;
using System.Collections.Generic;
using NzbDrone.Core.Rest;
using NLog;
using RestSharp;
using System.Linq;
using System.Net;
using Newtonsoft.Json.Linq;
using NLog;
using NzbDrone.Common.Extensions;
using NzbDrone.Core.Rest;
using RestSharp;
namespace NzbDrone.Core.Download.Clients.Deluge
{
@ -231,10 +232,15 @@ private IRestClient BuildClient(DelugeSettings settings)
{
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;

View File

@ -35,19 +35,22 @@ public DelugeSettings()
[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()