From 00099a5e40c21f09d4a01ed26099eff4fa34fdc7 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Sun, 22 Jan 2017 23:09:07 +0100 Subject: [PATCH] Added Base URL --- .../CouchPotato/CouchPotatoRequestGenerator.cs | 8 +++++++- .../NetImport/CouchPotato/CouchPotatoSettings.cs | 10 +++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoRequestGenerator.cs b/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoRequestGenerator.cs index 8fc5a4947..8a29dd112 100644 --- a/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoRequestGenerator.cs +++ b/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoRequestGenerator.cs @@ -21,7 +21,13 @@ namespace NzbDrone.Core.NetImport.CouchPotato private IEnumerable GetMovies(string searchParameters) { - var request = new NetImportRequest($"{Settings.Link.Trim()}:{Settings.Port}/api/{Settings.ApiKey}/movie.list/?status=active", HttpAccept.Json); + var urlBase = ""; + if (!string.IsNullOrWhiteSpace(Settings.UrlBase)) + { + urlBase = Settings.UrlBase.StartsWith("/") ? Settings.UrlBase : $"/{Settings.UrlBase}"; + } + + var request = new NetImportRequest($"{Settings.Link.Trim()}:{Settings.Port}{urlBase}/api/{Settings.ApiKey}/movie.list/?status=active", HttpAccept.Json); yield return request; } } diff --git a/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoSettings.cs b/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoSettings.cs index 15a6cf9cb..05744c825 100644 --- a/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoSettings.cs +++ b/src/NzbDrone.Core/NetImport/CouchPotato/CouchPotatoSettings.cs @@ -12,16 +12,20 @@ namespace NzbDrone.Core.NetImport.CouchPotato public CouchPotatoSettings() { Link = "http://localhost"; - Port = "5050"; + Port = 5050; + UrlBase = ""; } [FieldDefinition(0, Label = "CouchPotato URL", HelpText = "Link to your CoouchPootato.")] public new string Link { get; set; } [FieldDefinition(1, Label = "CouchPotato Port", HelpText = "Port your CoouchPootato uses.")] - public string Port { get; set; } + public int Port { get; set; } - [FieldDefinition(2, Label = "CouchPotato API Key", HelpText = "CoouchPootato API Key.")] + [FieldDefinition(2, Label = "CouchPotato Url Base", HelpText = "UrlBase your CoouchPootato uses, leave blank for none")] + public string UrlBase { get; set; } + + [FieldDefinition(3, Label = "CouchPotato API Key", HelpText = "CoouchPootato API Key.")] public string ApiKey { get; set; } } }