diff --git a/PlexRequests.Core/SettingModels/CouchPotatoSettings.cs b/PlexRequests.Core/SettingModels/CouchPotatoSettings.cs
index 7c18ca5d7..ff7ea01a5 100644
--- a/PlexRequests.Core/SettingModels/CouchPotatoSettings.cs
+++ b/PlexRequests.Core/SettingModels/CouchPotatoSettings.cs
@@ -38,12 +38,18 @@ namespace PlexRequests.Core.SettingModels
public string ApiKey { get; set; }
public bool Ssl { get; set; }
public string ProfileId { get; set; }
+ public string SubDir { get; set; }
[JsonIgnore]
public Uri FullUri
{
get
{
+ if (!string.IsNullOrEmpty(SubDir))
+ {
+ var formattedSubDir = Ip.ReturnUriWithSubDir(Port, Ssl, SubDir);
+ return formattedSubDir;
+ }
var formatted = Ip.ReturnUri(Port, Ssl);
return formatted;
}
diff --git a/PlexRequests.Core/SettingModels/PlexSettings.cs b/PlexRequests.Core/SettingModels/PlexSettings.cs
index 89bc01931..fa39af857 100644
--- a/PlexRequests.Core/SettingModels/PlexSettings.cs
+++ b/PlexRequests.Core/SettingModels/PlexSettings.cs
@@ -36,12 +36,18 @@ namespace PlexRequests.Core.SettingModels
public string Ip { get; set; }
public int Port { get; set; }
public bool Ssl { get; set; }
+ public string SubDir { get; set; }
[JsonIgnore]
public Uri FullUri
{
get
{
+ if (!string.IsNullOrEmpty(SubDir))
+ {
+ var formattedSubDir = Ip.ReturnUriWithSubDir(Port, Ssl, SubDir);
+ return formattedSubDir;
+ }
var formatted = Ip.ReturnUri(Port, Ssl);
return formatted;
}
diff --git a/PlexRequests.Core/SettingModels/SickRageSettings.cs b/PlexRequests.Core/SettingModels/SickRageSettings.cs
index 344e41434..657de3b50 100644
--- a/PlexRequests.Core/SettingModels/SickRageSettings.cs
+++ b/PlexRequests.Core/SettingModels/SickRageSettings.cs
@@ -39,12 +39,18 @@ namespace PlexRequests.Core.SettingModels
public string ApiKey { get; set; }
public string QualityProfile { get; set; }
public bool Ssl { get; set; }
+ public string SubDir { get; set; }
[JsonIgnore]
public Uri FullUri
{
get
{
+ if (!string.IsNullOrEmpty(SubDir))
+ {
+ var formattedSubDir = Ip.ReturnUriWithSubDir(Port, Ssl, SubDir);
+ return formattedSubDir;
+ }
var formatted = Ip.ReturnUri(Port, Ssl);
return formatted;
}
diff --git a/PlexRequests.Core/SettingModels/SonarrSettings.cs b/PlexRequests.Core/SettingModels/SonarrSettings.cs
index 2c128f993..3c680e0e5 100644
--- a/PlexRequests.Core/SettingModels/SonarrSettings.cs
+++ b/PlexRequests.Core/SettingModels/SonarrSettings.cs
@@ -41,12 +41,18 @@ namespace PlexRequests.Core.SettingModels
public bool SeasonFolders { get; set; }
public string RootPath { get; set; }
public bool Ssl { get; set; }
+ public string SubDir { get; set; }
[JsonIgnore]
public Uri FullUri
{
get
{
+ if (!string.IsNullOrEmpty(SubDir))
+ {
+ var formattedSubDir = Ip.ReturnUriWithSubDir(Port, Ssl, SubDir);
+ return formattedSubDir;
+ }
var formatted = Ip.ReturnUri(Port, Ssl);
return formatted;
}
diff --git a/PlexRequests.Helpers.Tests/UriHelperTests.cs b/PlexRequests.Helpers.Tests/UriHelperTests.cs
index 7c767dfd0..93fb32997 100644
--- a/PlexRequests.Helpers.Tests/UriHelperTests.cs
+++ b/PlexRequests.Helpers.Tests/UriHelperTests.cs
@@ -26,6 +26,7 @@
#endregion
using System;
+using System.Linq.Expressions;
using NUnit.Framework;
namespace PlexRequests.Helpers.Tests
@@ -35,7 +36,7 @@ namespace PlexRequests.Helpers.Tests
{
[TestCaseSource(nameof(UriData))]
public void CreateUri1(string uri, Uri expected)
- {
+ {
var result = uri.ReturnUri();
Assert.That(result, Is.EqualTo(expected));
@@ -58,6 +59,14 @@ namespace PlexRequests.Helpers.Tests
Assert.That(result, Is.EqualTo(expected));
}
+ [TestCaseSource(nameof(UriDataWithSubDir))]
+ public void CreateUriWithSubDir(string uri, int port, bool ssl, string subDir, Uri expected)
+ {
+ var result = uri.ReturnUriWithSubDir(port, ssl, subDir);
+
+ Assert.That(result, Is.EqualTo(expected));
+ }
+
static readonly object[] UriData =
{
new object[] { "google.com", new Uri("http://google.com/"), },
@@ -84,5 +93,13 @@ namespace PlexRequests.Helpers.Tests
new object[] {"http://www.google.com/id=2", 443, new Uri("http://www.google.com:443/id=2") },
new object[] {"https://www.google.com/id=2", 443, new Uri("https://www.google.com:443/id=2") },
};
+
+ static readonly object[] UriDataWithSubDir =
+{
+ new object[] {"www.google.com", 80, false,"test", new Uri("http://www.google.com:80/test"), },
+ new object[] {"www.google.com", 443, false,"test", new Uri("http://www.google.com:443/test") },
+ new object[] {"http://www.google.com", 443, true,"test", new Uri("https://www.google.com:443/test") },
+ new object[] {"https://www.google.com", 443,true,"test", new Uri("https://www.google.com:443/test") },
+ };
}
}
\ No newline at end of file
diff --git a/PlexRequests.Helpers/UriHelper.cs b/PlexRequests.Helpers/UriHelper.cs
index c33d5ddf4..707f70436 100644
--- a/PlexRequests.Helpers/UriHelper.cs
+++ b/PlexRequests.Helpers/UriHelper.cs
@@ -53,7 +53,10 @@ namespace PlexRequests.Helpers
///
/// The value.
/// The port.
+ /// if set to