Add urlBase option to CP settings

pull/2/head
Devin Buhl 8 years ago
parent 1fa736c6d8
commit 3ff5b36d29

@ -21,7 +21,13 @@ namespace NzbDrone.Core.NetImport.CouchPotato
private IEnumerable<NetImportRequest> 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;
}
}

@ -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; }
}
}

Loading…
Cancel
Save