Added Base URL

pull/497/head
Leonardo Galli 8 years ago
parent 7c251157ed
commit 00099a5e40

@ -21,7 +21,13 @@ namespace NzbDrone.Core.NetImport.CouchPotato
private IEnumerable<NetImportRequest> GetMovies(string searchParameters) 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; yield return request;
} }
} }

@ -12,16 +12,20 @@ namespace NzbDrone.Core.NetImport.CouchPotato
public CouchPotatoSettings() public CouchPotatoSettings()
{ {
Link = "http://localhost"; Link = "http://localhost";
Port = "5050"; Port = 5050;
UrlBase = "";
} }
[FieldDefinition(0, Label = "CouchPotato URL", HelpText = "Link to your CoouchPootato.")] [FieldDefinition(0, Label = "CouchPotato URL", HelpText = "Link to your CoouchPootato.")]
public new string Link { get; set; } public new string Link { get; set; }
[FieldDefinition(1, Label = "CouchPotato Port", HelpText = "Port your CoouchPootato uses.")] [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; } public string ApiKey { get; set; }
} }
} }

Loading…
Cancel
Save