mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-16 10:03:51 -07:00
New: Added optional UrlBase to Nzbget, Sabnzbd, and Subsonic settings (#428)
* New: Added optional UrlBase to Nzbget, Sabnzbd, and Subsonic settings Fixes #386 * fixup! Remove commented code
This commit is contained in:
parent
3ac378695c
commit
9aa40f546f
10 changed files with 81 additions and 44 deletions
|
@ -1,5 +1,6 @@
|
|||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Common.Http;
|
||||
using NzbDrone.Core.Rest;
|
||||
using RestSharp;
|
||||
using System.IO;
|
||||
|
@ -9,6 +10,7 @@ namespace NzbDrone.Core.Notifications.Subsonic
|
|||
{
|
||||
public interface ISubsonicServerProxy
|
||||
{
|
||||
string GetBaseUrl(SubsonicSettings settings, string relativePath = null);
|
||||
void Notify(SubsonicSettings settings, string message);
|
||||
void Update(SubsonicSettings settings);
|
||||
string Version(SubsonicSettings settings);
|
||||
|
@ -23,6 +25,14 @@ namespace NzbDrone.Core.Notifications.Subsonic
|
|||
_logger = logger;
|
||||
}
|
||||
|
||||
public string GetBaseUrl(SubsonicSettings settings, string relativePath = null)
|
||||
{
|
||||
var baseUrl = HttpRequestBuilder.BuildBaseUrl(settings.UseSsl, settings.Host, settings.Port, settings.UrlBase);
|
||||
baseUrl = HttpUri.CombinePath(baseUrl, relativePath);
|
||||
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public void Notify(SubsonicSettings settings, string message)
|
||||
{
|
||||
var resource = "addChatMessage";
|
||||
|
@ -68,9 +78,7 @@ namespace NzbDrone.Core.Notifications.Subsonic
|
|||
|
||||
private RestClient GetSubsonicServerClient(SubsonicSettings settings)
|
||||
{
|
||||
var protocol = settings.UseSsl ? "https" : "http";
|
||||
|
||||
return RestClientFactory.BuildClient(string.Format("{0}://{1}:{2}/rest", protocol, settings.Host, settings.Port));
|
||||
return RestClientFactory.BuildClient(GetBaseUrl(settings, "rest"));
|
||||
}
|
||||
|
||||
private RestRequest GetSubsonicServerRequest(string resource, Method method, SubsonicSettings settings)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue