diff --git a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs index af24f2797..b70021190 100644 --- a/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs +++ b/src/NzbDrone.Core.Test/Download/DownloadClientTests/DelugeTests/DelugeFixture.cs @@ -26,7 +26,7 @@ namespace NzbDrone.Core.Test.Download.DownloadClientTests.DelugeTests Subject.Definition = new DownloadClientDefinition(); Subject.Definition.Settings = new DelugeSettings() { - TvCategory = null + MovieCategory = null }; _queued = new DelugeTorrent diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs index 810fa3f8c..831c31b4f 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs @@ -31,25 +31,17 @@ namespace NzbDrone.Core.Download.Clients.Deluge _proxy = proxy; } - protected override string AddFromMagnetLink(RemoteMovie remoteEpisode, string hash, string magnetLink) + protected override string AddFromMagnetLink(RemoteMovie remoteMovie, string hash, string magnetLink) { var actualHash = _proxy.AddTorrentFromMagnet(magnetLink, Settings); - if (!Settings.TvCategory.IsNullOrWhiteSpace()) + if (!Settings.MovieCategory.IsNullOrWhiteSpace()) { - _proxy.SetLabel(actualHash, Settings.TvCategory, Settings); + _proxy.SetLabel(actualHash, Settings.MovieCategory, Settings); } _proxy.SetTorrentConfiguration(actualHash, "remove_at_ratio", false, Settings); - /*var isRecentEpisode = remoteEpisode.IsRecentEpisode(); - - if (isRecentEpisode && Settings.RecentTvPriority == (int)DelugePriority.First || - !isRecentEpisode && Settings.OlderTvPriority == (int)DelugePriority.First) - { - _proxy.MoveTorrentToTopInQueue(actualHash, Settings); - }*/ - return actualHash.ToUpper(); } @@ -57,66 +49,24 @@ namespace NzbDrone.Core.Download.Clients.Deluge { var actualHash = _proxy.AddTorrentFromFile(filename, fileContent, Settings); - if (!Settings.TvCategory.IsNullOrWhiteSpace()) + if (!Settings.MovieCategory.IsNullOrWhiteSpace()) { - _proxy.SetLabel(actualHash, Settings.TvCategory, Settings); + _proxy.SetLabel(actualHash, Settings.MovieCategory, Settings); } _proxy.SetTorrentConfiguration(actualHash, "remove_at_ratio", false, Settings); - /*var isRecentEpisode = remoteEpisode.IsRecentEpisode(); - - if (isRecentEpisode && Settings.RecentTvPriority == (int)DelugePriority.First || - !isRecentEpisode && Settings.OlderTvPriority == (int)DelugePriority.First) - { - _proxy.MoveTorrentToTopInQueue(actualHash, Settings); - }*/ - return actualHash.ToUpper(); } protected override string AddFromMagnetLink(RemoteEpisode remoteEpisode, string hash, string magnetLink) { - var actualHash = _proxy.AddTorrentFromMagnet(magnetLink, Settings); - - if (!Settings.TvCategory.IsNullOrWhiteSpace()) - { - _proxy.SetLabel(actualHash, Settings.TvCategory, Settings); - } - - _proxy.SetTorrentConfiguration(actualHash, "remove_at_ratio", false, Settings); - - var isRecentEpisode = remoteEpisode.IsRecentEpisode(); - - if (isRecentEpisode && Settings.RecentTvPriority == (int)DelugePriority.First || - !isRecentEpisode && Settings.OlderTvPriority == (int)DelugePriority.First) - { - _proxy.MoveTorrentToTopInQueue(actualHash, Settings); - } - - return actualHash.ToUpper(); + throw new NotImplementedException("Episodes are not working with Radarr"); } protected override string AddFromTorrentFile(RemoteEpisode remoteEpisode, string hash, string filename, byte[] fileContent) { - var actualHash = _proxy.AddTorrentFromFile(filename, fileContent, Settings); - - if (!Settings.TvCategory.IsNullOrWhiteSpace()) - { - _proxy.SetLabel(actualHash, Settings.TvCategory, Settings); - } - - _proxy.SetTorrentConfiguration(actualHash, "remove_at_ratio", false, Settings); - - var isRecentEpisode = remoteEpisode.IsRecentEpisode(); - - if (isRecentEpisode && Settings.RecentTvPriority == (int)DelugePriority.First || - !isRecentEpisode && Settings.OlderTvPriority == (int)DelugePriority.First) - { - _proxy.MoveTorrentToTopInQueue(actualHash, Settings); - } - - return actualHash.ToUpper(); + throw new NotImplementedException("Episodes are not working with Radarr"); } public override string Name => "Deluge"; @@ -127,9 +77,9 @@ namespace NzbDrone.Core.Download.Clients.Deluge try { - if (!Settings.TvCategory.IsNullOrWhiteSpace()) + if (!Settings.MovieCategory.IsNullOrWhiteSpace()) { - torrents = _proxy.GetTorrentsByLabel(Settings.TvCategory, Settings); + torrents = _proxy.GetTorrentsByLabel(Settings.MovieCategory, Settings); } else { @@ -149,7 +99,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge var item = new DownloadClientItem(); item.DownloadId = torrent.Hash.ToUpper(); item.Title = torrent.Name; - item.Category = Settings.TvCategory; + item.Category = Settings.MovieCategory; item.DownloadClient = Definition.Name; @@ -280,7 +230,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge private ValidationFailure TestCategory() { - if (Settings.TvCategory.IsNullOrWhiteSpace()) + if (Settings.MovieCategory.IsNullOrWhiteSpace()) { return null; } @@ -297,14 +247,14 @@ namespace NzbDrone.Core.Download.Clients.Deluge var labels = _proxy.GetAvailableLabels(Settings); - if (!labels.Contains(Settings.TvCategory)) + if (!labels.Contains(Settings.MovieCategory)) { - _proxy.AddLabel(Settings.TvCategory, Settings); + _proxy.AddLabel(Settings.MovieCategory, Settings); labels = _proxy.GetAvailableLabels(Settings); - if (!labels.Contains(Settings.TvCategory)) + if (!labels.Contains(Settings.MovieCategory)) { - return new NzbDroneValidationFailure("TvCategory", "Configuration of label failed") + return new NzbDroneValidationFailure("MovieCategory", "Configuration of label failed") { DetailedDescription = "Radarr as unable to add the label to Deluge." }; diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs index 73bc0212a..a7175dff6 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs @@ -12,7 +12,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge RuleFor(c => c.Host).ValidHost(); RuleFor(c => c.Port).GreaterThan(0); - RuleFor(c => c.TvCategory).Matches("^[-a-z]*$").WithMessage("Allowed characters a-z and -"); + RuleFor(c => c.MovieCategory).Matches("^[-a-z]*$").WithMessage("Allowed characters a-z and -"); } } @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge Host = "localhost"; Port = 8112; Password = "deluge"; - TvCategory = "movie-radarr"; + MovieCategory = "movie-radarr"; } [FieldDefinition(0, Label = "Host", Type = FieldType.Textbox)] @@ -41,15 +41,9 @@ namespace NzbDrone.Core.Download.Clients.Deluge 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(DelugePriority), HelpText = "Priority to use when grabbing episodes that aired within the last 14 days")] - public int RecentTvPriority { get; set; } - - [FieldDefinition(6, Label = "Older Priority", Type = FieldType.Select, SelectOptions = typeof(DelugePriority), HelpText = "Priority to use when grabbing episodes that aired over 14 days ago")] - public int OlderTvPriority { get; set; } - - [FieldDefinition(7, Label = "Use SSL", Type = FieldType.Checkbox)] + [FieldDefinition(5, Label = "Use SSL", Type = FieldType.Checkbox)] public bool UseSsl { get; set; } public NzbDroneValidationResult Validate()