Changed: Nzbget Rename TvCategory references to MovieCategory (#2211)

James White 7 years ago committed by Leonardo Galli
parent b313dd1845
commit 5674d8ad60

@ -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<NzbgetParameter> { 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<NzbgetParameter> { 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<NzbgetParameter> { new NzbgetParameter { Name = "drone", Value = "id" } },
@ -81,8 +81,8 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.NzbgetTests
});
var configItems = new Dictionary<string, string>();
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<INzbgetProxy>()
.Setup(v => v.GetConfig(It.IsAny<NzbgetSettings>()))

@ -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<DownloadClientItem> 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."
};
}

@ -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<JsonRpcResponse<T>>(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;

@ -1,4 +1,4 @@
namespace NzbDrone.Core.Download.Clients.Nzbget
namespace NzbDrone.Core.Download.Clients.Nzbget
{
public class NzbgetResponse<T>
{

@ -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()

Loading…
Cancel
Save