From 8616bcedd497f6059b0e8bde4d92ac8d9751e162 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Thu, 5 Jan 2017 11:04:29 +0100 Subject: [PATCH] Fixes Deluge for movies. --- .../Download/Clients/Deluge/Deluge.cs | 44 +++++++++++++++++++ .../Download/Clients/Deluge/DelugeSettings.cs | 4 +- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs index 39174d3b8..6312672a6 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/Deluge.cs @@ -31,6 +31,50 @@ namespace NzbDrone.Core.Download.Clients.Deluge _proxy = proxy; } + protected override string AddFromMagnetLink(RemoteMovie 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(); + } + + protected override string AddFromTorrentFile(RemoteMovie 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(); + } + protected override string AddFromMagnetLink(RemoteEpisode remoteEpisode, string hash, string magnetLink) { var actualHash = _proxy.AddTorrentFromMagnet(magnetLink, Settings); diff --git a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs index b5fd1153e..73bc0212a 100644 --- a/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/Deluge/DelugeSettings.cs @@ -25,7 +25,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge Host = "localhost"; Port = 8112; Password = "deluge"; - TvCategory = "tv-sonarr"; + TvCategory = "movie-radarr"; } [FieldDefinition(0, Label = "Host", Type = FieldType.Textbox)] @@ -40,7 +40,7 @@ namespace NzbDrone.Core.Download.Clients.Deluge [FieldDefinition(3, Label = "Password", Type = FieldType.Password)] public string Password { get; set; } - [FieldDefinition(4, Label = "Category", Type = FieldType.Textbox, HelpText = "Adding a category specific to Sonarr avoids conflicts with unrelated downloads, but it's optional")] + [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; } [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")]