diff --git a/NzbDrone.Core/Model/DownloadClientType.cs b/NzbDrone.Core/Model/DownloadClientType.cs new file mode 100644 index 000000000..906ff3f9a --- /dev/null +++ b/NzbDrone.Core/Model/DownloadClientType.cs @@ -0,0 +1,8 @@ +namespace NzbDrone.Core.Model +{ + public enum DownloadClientType + { + Sabnzbd = 0, + Blackhole = 1 + } +} \ No newline at end of file diff --git a/NzbDrone.Core/NzbDrone.Core.csproj b/NzbDrone.Core/NzbDrone.Core.csproj index db80ed76c..2e22a4faf 100644 --- a/NzbDrone.Core/NzbDrone.Core.csproj +++ b/NzbDrone.Core/NzbDrone.Core.csproj @@ -228,6 +228,7 @@ + diff --git a/NzbDrone.Core/Providers/Core/ConfigProvider.cs b/NzbDrone.Core/Providers/Core/ConfigProvider.cs index 3643c0801..ea684f1e8 100644 --- a/NzbDrone.Core/Providers/Core/ConfigProvider.cs +++ b/NzbDrone.Core/Providers/Core/ConfigProvider.cs @@ -409,6 +409,13 @@ public virtual bool AutoIgnorePreviouslyDownloadedEpisodes set { SetValue("AutoIgnorePreviouslyDownloadedEpisodes", value); } } + public virtual DownloadClientType DownloadClient + { + get { return (DownloadClientType)GetValueInt("DownloadClient"); } + + set { SetValue("DownloadClient", (int)value); } + } + public string UGuid { get { return GetValue("UGuid", Guid.NewGuid().ToString(), persist: true); } diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index 1c84065d6..3d439d40d 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -6,6 +6,7 @@ using NzbDrone.Common; using NzbDrone.Common.Model; using NzbDrone.Core.Helpers; +using NzbDrone.Core.Model; using NzbDrone.Core.Providers; using NzbDrone.Core.Providers.Core; using NzbDrone.Core.Providers.ExternalNotification; @@ -90,12 +91,17 @@ public ActionResult Indexers() }); } - public ActionResult Sabnzbd() + public ActionResult DownloadClient() { var tvCategory = _configProvider.SabTvCategory; var tvCategorySelectList = new SelectList(new[] { tvCategory }); - var model = new SabnzbdSettingsModel + var downloadClientTypes = new List>(); + + foreach (DownloadClientType downloadClientType in Enum.GetValues(typeof(DownloadClientType))) + downloadClientTypes.Add(new KeyValuePair((int)downloadClientType, downloadClientType.ToString())); + + var model = new DownloadClientSettingsModel { SabHost = _configProvider.SabHost, SabPort = _configProvider.SabPort, @@ -104,8 +110,10 @@ public ActionResult Sabnzbd() SabPassword = _configProvider.SabPassword, SabTvCategory = tvCategory, SabTvPriority = _configProvider.SabTvPriority, - SabDropDirectory = _configProvider.SabDropDirectory, - SabTvCategorySelectList = tvCategorySelectList + DownloadClientDropDirectory = _configProvider.SabDropDirectory, + SabTvCategorySelectList = tvCategorySelectList, + DownloadClient = (int)_configProvider.DownloadClient, + DownloadClientSelectList = new SelectList(downloadClientTypes, "Key", "Value") }; return View(model); @@ -373,11 +381,10 @@ public JsonResult SaveIndexers(IndexerSettingsModel data) } [HttpPost] - public JsonResult SaveSabnzbd(SabnzbdSettingsModel data) + public JsonResult SaveDownloadClient(DownloadClientSettingsModel data) { if (ModelState.IsValid) { - _configProvider.SabHost = data.SabHost; _configProvider.SabPort = data.SabPort; _configProvider.SabApiKey = data.SabApiKey; @@ -385,8 +392,8 @@ public JsonResult SaveSabnzbd(SabnzbdSettingsModel data) _configProvider.SabTvCategory = data.SabTvCategory; _configProvider.SabUsername = data.SabUsername; _configProvider.SabTvPriority = data.SabTvPriority; - _configProvider.SabDropDirectory = data.SabDropDirectory; - + _configProvider.SabDropDirectory = data.DownloadClientDropDirectory; + _configProvider.DownloadClient = (DownloadClientType)data.DownloadClient; return GetSuccessResult(); } diff --git a/NzbDrone.Web/Models/SabnzbdSettingsModel.cs b/NzbDrone.Web/Models/DownloadClientSettingsModel.cs similarity index 74% rename from NzbDrone.Web/Models/SabnzbdSettingsModel.cs rename to NzbDrone.Web/Models/DownloadClientSettingsModel.cs index e1e184286..3e2810e4a 100644 --- a/NzbDrone.Web/Models/SabnzbdSettingsModel.cs +++ b/NzbDrone.Web/Models/DownloadClientSettingsModel.cs @@ -7,7 +7,7 @@ namespace NzbDrone.Web.Models { - public class SabnzbdSettingsModel + public class DownloadClientSettingsModel { public SelectList PrioritySelectList = new SelectList(new[] {"Default", "Paused", "Low", "Normal", "High", "Top"}); @@ -53,11 +53,21 @@ public class SabnzbdSettingsModel [Description("Priority to use when sending NZBs to SABnzbd")] public SabPriorityType SabTvPriority { get; set; } - [DisplayName("SABnzbd TV Directory")] - [Description("The directory where SABnzbd downloads TV shows to (NzbDrone will sort them for you)")] + [DisplayName("Download Client TV Directory")] + [Description("The directory where your download client downloads TV shows to (NzbDrone will sort them for you)")] [DisplayFormat(ConvertEmptyStringToNull = false)] - public string SabDropDirectory { get; set; } + public string DownloadClientDropDirectory { get; set; } + + [DisplayName("Blackhole Directory")] + [Description("The directory where your download client will pickup NZB files")] + [DisplayFormat(ConvertEmptyStringToNull = false)] + public string BlackholeDirectory { get; set; } + + [DisplayName("Download Client")] + [Description("What method do you download NZBs with?")] + public int DownloadClient { get; set; } public SelectList SabTvCategorySelectList { get; set; } + public SelectList DownloadClientSelectList { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index b6a2e430f..a60a232a0 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -235,7 +235,7 @@ - + @@ -532,6 +532,12 @@ + + + + + +