From 0b9a4e1a4637433a37d20d575b20dad40ff1ead2 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Tue, 22 Jan 2013 21:08:21 -0800 Subject: [PATCH] Use scene name for download client queue #ND-136 fixed New: Option to Scene name when adding NZBs to download client queue --- NzbDrone.Core/Providers/Core/ConfigProvider.cs | 7 +++++++ NzbDrone.Core/Providers/DownloadProvider.cs | 6 ++++++ NzbDrone.Web/Controllers/SettingsController.cs | 4 +++- NzbDrone.Web/Models/DownloadClientSettingsModel.cs | 4 ++++ NzbDrone.Web/Views/Settings/DownloadClient.cshtml | 6 ++++++ 5 files changed, 26 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Core/Providers/Core/ConfigProvider.cs b/NzbDrone.Core/Providers/Core/ConfigProvider.cs index 43c6b08db..2ed3a2833 100644 --- a/NzbDrone.Core/Providers/Core/ConfigProvider.cs +++ b/NzbDrone.Core/Providers/Core/ConfigProvider.cs @@ -534,6 +534,13 @@ public virtual Boolean IgnoreArticlesWhenSortingSeries set { SetValue("IgnoreArticlesWhenSortingSeries", value); } } + public virtual Boolean DownloadClientUseSceneName + { + get { return GetValueBoolean("DownloadClientUseSceneName", false); } + + set { SetValue("DownloadClientUseSceneName", value); } + } + private string GetValue(string key) { return GetValue(key, String.Empty); diff --git a/NzbDrone.Core/Providers/DownloadProvider.cs b/NzbDrone.Core/Providers/DownloadProvider.cs index fb070d0de..25302e826 100644 --- a/NzbDrone.Core/Providers/DownloadProvider.cs +++ b/NzbDrone.Core/Providers/DownloadProvider.cs @@ -97,6 +97,12 @@ public virtual IDownloadClient GetActiveDownloadClient() public virtual String GetDownloadTitle(EpisodeParseResult parseResult) { + if(_configProvider.DownloadClientUseSceneName) + { + logger.Trace("Using scene name: {0}", parseResult.OriginalString); + return parseResult.OriginalString; + } + var seriesTitle = MediaFileProvider.CleanFilename(parseResult.Series.Title); //Handle Full Naming diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index 15b36aa40..4dd65c053 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -144,7 +144,8 @@ public ActionResult DownloadClient() DownloadClient = (int)_configProvider.DownloadClient, BlackholeDirectory = _configProvider.BlackholeDirectory, DownloadClientSelectList = new SelectList(downloadClientTypes, "Key", "Value"), - PneumaticDirectory = _configProvider.PneumaticDirectory + PneumaticDirectory = _configProvider.PneumaticDirectory, + UseSceneName = _configProvider.DownloadClientUseSceneName }; return View(model); @@ -458,6 +459,7 @@ public JsonResult SaveDownloadClient(DownloadClientSettingsModel data) _configProvider.BlackholeDirectory = data.BlackholeDirectory; _configProvider.DownloadClient = (DownloadClientType)data.DownloadClient; _configProvider.PneumaticDirectory = data.PneumaticDirectory; + _configProvider.DownloadClientUseSceneName = data.UseSceneName; return GetSuccessResult(); } diff --git a/NzbDrone.Web/Models/DownloadClientSettingsModel.cs b/NzbDrone.Web/Models/DownloadClientSettingsModel.cs index e4f04bf71..b15ff3988 100644 --- a/NzbDrone.Web/Models/DownloadClientSettingsModel.cs +++ b/NzbDrone.Web/Models/DownloadClientSettingsModel.cs @@ -81,6 +81,10 @@ public class DownloadClientSettingsModel [RequiredIf("DownloadClient", (int)DownloadClientType.Pneumatic, ErrorMessage = "Required when Download Client is Blackhole")] public string PneumaticDirectory { get; set; } + [DisplayName("Use Scene Name")] + [Description("Use Scene name when adding NZB to queue?")] + public Boolean UseSceneName { get; set; } + public SelectList SabTvCategorySelectList { get; set; } public SelectList DownloadClientSelectList { get; set; } } diff --git a/NzbDrone.Web/Views/Settings/DownloadClient.cshtml b/NzbDrone.Web/Views/Settings/DownloadClient.cshtml index 5a0b26536..0591e15f4 100644 --- a/NzbDrone.Web/Views/Settings/DownloadClient.cshtml +++ b/NzbDrone.Web/Views/Settings/DownloadClient.cshtml @@ -37,11 +37,17 @@ @Html.DescriptionFor(m => m.DownloadClient) @Html.DropDownListFor(m => m.DownloadClient, Model.DownloadClientSelectList, new { @class = "inputClass selectClass" }) + @Html.TextBoxFor(m => m.DownloadClientDropDirectory, new { @class = "inputClass folderLookup" }) + + + @Html.CheckBoxFor(m => m.UseSceneName, new { @class = "inputClass checkClass" })