mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-21 22:04:31 -04: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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user