From 5674d8ad60cb46be76ee733d87e5b90624c2332e Mon Sep 17 00:00:00 2001 From: James White Date: Mon, 23 Oct 2017 20:47:49 +0100 Subject: [PATCH] Changed: Nzbget Rename TvCategory references to MovieCategory (#2211) --- .../NzbgetTests/NzbgetFixture.cs | 12 +++++------ .../Download/Clients/Nzbget/Nzbget.cs | 20 +++++++++---------- .../Download/Clients/Nzbget/NzbgetProxy.cs | 20 +++++++++---------- .../Download/Clients/Nzbget/NzbgetResponse.cs | 2 +- .../Download/Clients/Nzbget/NzbgetSettings.cs | 10 +++++----- 5 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs index 91e786492..995d73e64 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/NzbgetTests/NzbgetFixture.cs @@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests Port = 2222, Username = "admin", Password = "pass", - TvCategory = "tv", + MovieCategory = "movie", RecentTvPriority = (int)NzbgetPriority.High }; @@ -38,7 +38,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests { FileSizeLo = 1000, RemainingSizeLo = 10, - Category = "tv", + Category = "movie", NzbName = "Droned.1998.1080p.WEB-DL-DRONE", Parameters = new List { new NzbgetParameter { Name = "drone", Value = "id" } } }; @@ -46,7 +46,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests _failed = new NzbgetHistoryItem { FileSizeLo = 1000, - Category = "tv", + Category = "movie", Name = "Droned.1998.1080p.WEB-DL-DRONE", DestDir = "somedirectory", Parameters = new List { new NzbgetParameter { Name = "drone", Value = "id" } }, @@ -61,7 +61,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests _completed = new NzbgetHistoryItem { FileSizeLo = 1000, - Category = "tv", + Category = "movie", Name = "Droned.1998.1080p.WEB-DL-DRONE", DestDir = "/remote/mount/tv/Droned.1998.1080p.WEB-DL-DRONE", Parameters = new List { new NzbgetParameter { Name = "drone", Value = "id" } }, @@ -81,8 +81,8 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests }); var configItems = new Dictionary(); - configItems.Add("Category1.Name", "tv"); - configItems.Add("Category1.DestDir", @"/remote/mount/tv"); + configItems.Add("Category1.Name", "movie"); + configItems.Add("Category1.DestDir", @"/remote/mount/movie"); Mocker.GetMock() .Setup(v => v.GetConfig(It.IsAny())) diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs index f039350d1..ba98e789f 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/Nzbget.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using System.Collections.Generic; @@ -38,7 +38,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget protected override string AddFromNzbFile(RemoteMovie remoteMovie, string filename, byte[] fileContents) { - var category = Settings.TvCategory; // TODO: Update this to MovieCategory? + var category = Settings.MovieCategory; var priority = Settings.RecentTvPriority; @@ -204,7 +204,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget public override IEnumerable GetItems() { - return GetQueue().Concat(GetHistory()).Where(downloadClientItem => downloadClientItem.Category == Settings.TvCategory); + return GetQueue().Concat(GetHistory()).Where(downloadClientItem => downloadClientItem.Category == Settings.MovieCategory); } public override void RemoveItem(string downloadId, bool deleteData) @@ -221,7 +221,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget { var config = _proxy.GetConfig(Settings); - var category = GetCategories(config).FirstOrDefault(v => v.Name == Settings.TvCategory); + var category = GetCategories(config).FirstOrDefault(v => v.Name == Settings.MovieCategory); var status = new DownloadClientStatus { @@ -283,7 +283,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget if (Version.Parse(version) < Version.Parse("12.0")) { - return new ValidationFailure(string.Empty, "Nzbget version too low, need 12.0 or higher"); + return new ValidationFailure(string.Empty, "NZBGet version too low, need 12.0 or higher"); } } catch (Exception ex) @@ -304,12 +304,12 @@ namespace NzbDrone.Core.Download.Clients.Nzbget var config = _proxy.GetConfig(Settings); var categories = GetCategories(config); - if (!Settings.TvCategory.IsNullOrWhiteSpace() && !categories.Any(v => v.Name == Settings.TvCategory)) + if (!Settings.MovieCategory.IsNullOrWhiteSpace() && !categories.Any(v => v.Name == Settings.MovieCategory)) { - return new NzbDroneValidationFailure("TvCategory", "Category does not exist") + return new NzbDroneValidationFailure("MovieCategory", "Category does not exist") { InfoLink = string.Format("http://{0}:{1}/", Settings.Host, Settings.Port), - DetailedDescription = "The Category your entered doesn't exist in NzbGet. Go to NzbGet to create it." + DetailedDescription = "The category you entered doesn't exist in NZBGet. Go to NZBGet to create it." }; } @@ -323,10 +323,10 @@ namespace NzbDrone.Core.Download.Clients.Nzbget var keepHistory = config.GetValueOrDefault("KeepHistory"); if (keepHistory == "0") { - return new NzbDroneValidationFailure(string.Empty, "NzbGet setting KeepHistory should be greater than 0") + return new NzbDroneValidationFailure(string.Empty, "NZBGet setting KeepHistory should be greater than 0") { InfoLink = string.Format("http://{0}:{1}/", Settings.Host, Settings.Port), - DetailedDescription = "NzbGet setting KeepHistory is set to 0. Which prevents Radarr from seeing completed downloads." + DetailedDescription = "NZBGet setting KeepHistory is set to 0. Which prevents Radarr from seeing completed downloads." }; } diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProxy.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProxy.cs index 7a21b45b1..aece0a615 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProxy.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetProxy.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using NLog; @@ -88,7 +88,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget var editResult = EditQueue("GroupSetParameter", 0, "drone=" + droneId, item.NzbId, settings); if (editResult) { - _logger.Debug("Nzbget download drone parameter set to: {0}", droneId); + _logger.Debug("NZBGet download drone parameter set to: {0}", droneId); } return droneId; @@ -114,7 +114,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget if (editResult) { - _logger.Debug("Nzbget download drone parameter set to: {0}", droneId); + _logger.Debug("NZBGet download drone parameter set to: {0}", droneId); } return droneId; @@ -175,7 +175,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget { if (!EditQueue("GroupFinalDelete", 0, "", queueItem.NzbId, settings)) { - _logger.Warn("Failed to remove item from nzbget queue, {0} [{1}]", queueItem.NzbName, queueItem.NzbId); + _logger.Warn("Failed to remove item from NZBGet, {0} [{1}]", queueItem.NzbName, queueItem.NzbId); } } @@ -183,13 +183,13 @@ namespace NzbDrone.Core.Download.Clients.Nzbget { if (!EditQueue("HistoryDelete", 0, "", historyItem.Id, settings)) { - _logger.Warn("Failed to remove item from nzbget history, {0} [{1}]", historyItem.Name, historyItem.Id); + _logger.Warn("Failed to remove item from NZBGet history, {0} [{1}]", historyItem.Name, historyItem.Id); } } else { - _logger.Warn("Unable to remove item from nzbget, Unknown ID: {0}", id); + _logger.Warn("Unable to remove item from NZBGet, Unknown ID: {0}", id); return; } } @@ -235,21 +235,21 @@ namespace NzbDrone.Core.Download.Clients.Nzbget { if (ex.Response.StatusCode == HttpStatusCode.Unauthorized) { - throw new DownloadClientException("Authentication failed for NzbGet, please check your settings", ex); + throw new DownloadClientException("Authentication failed for NZBGet, please check your settings", ex); } - throw new DownloadClientException("Unable to connect to NzbGet. " + ex.Message, ex); + throw new DownloadClientException("Unable to connect to NZBGet. " + ex.Message, ex); } catch (WebException ex) { - throw new DownloadClientException("Unable to connect to NzbGet. " + ex.Message, ex); + throw new DownloadClientException("Unable to connect to NZBGet. " + ex.Message, ex); } var result = Json.Deserialize>(response.Content); if (result.Error != null) { - throw new DownloadClientException("Error response received from nzbget: {0}", result.Error.ToString()); + throw new DownloadClientException("Error response received from NZBGet: {0}", result.Error.ToString()); } return result.Result; diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetResponse.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetResponse.cs index f1546593e..a41667824 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetResponse.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetResponse.cs @@ -1,4 +1,4 @@ -namespace NzbDrone.Core.Download.Clients.Nzbget +namespace NzbDrone.Core.Download.Clients.Nzbget { public class NzbgetResponse { diff --git a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs index 0ddd890a9..d0a8ee0a6 100644 --- a/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Nzbget/NzbgetSettings.cs @@ -1,4 +1,4 @@ -using FluentValidation; +using FluentValidation; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -14,7 +14,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget RuleFor(c => c.Username).NotEmpty().When(c => !string.IsNullOrWhiteSpace(c.Password)); RuleFor(c => c.Password).NotEmpty().When(c => !string.IsNullOrWhiteSpace(c.Username)); - RuleFor(c => c.TvCategory).NotEmpty().WithMessage("A category is recommended").AsWarning(); + RuleFor(c => c.MovieCategory).NotEmpty().WithMessage("A category is recommended").AsWarning(); } } @@ -26,7 +26,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget { Host = "localhost"; Port = 6789; - TvCategory = "Movies"; + MovieCategory = "Movies"; Username = "nzbget"; Password = "tegbzn6789"; RecentTvPriority = (int)NzbgetPriority.Normal; @@ -46,7 +46,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget public string Password { get; set; } [FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Radarr avoids conflicts with unrelated downloads, but it's optional")] - public string TvCategory { get; set; } + public string MovieCategory { get; set; } [FieldDefinition(5, Label = "Recent Priority", Type = FieldType.Select, SelectOptions = typeof(NzbgetPriority), HelpText = "Priority to use when grabbing releases that aired within the last 14 days")] public int RecentTvPriority { get; set; } @@ -57,7 +57,7 @@ namespace NzbDrone.Core.Download.Clients.Nzbget [FieldDefinition(7, Label = "Use SSL", Type = FieldType.Checkbox)] public bool UseSsl { get; set; } - [FieldDefinition(8, Label = "Add Paused", Type = FieldType.Checkbox, HelpText = "This option requires at least NzbGet version 16.0")] + [FieldDefinition(8, Label = "Add Paused", Type = FieldType.Checkbox, HelpText = "This option requires at least NZBGet version 16.0")] public bool AddPaused { get; set; } public NzbDroneValidationResult Validate()