From 15cefe4a432b18a6ecf15364a2c2b8c90cd157f5 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sat, 19 Dec 2015 17:18:22 -0800 Subject: [PATCH] New: Option to Hardlink or Copy instead of move for Torrent Blackhole Closes #1011 --- .../Clients/TorrentBlackhole/TorrentBlackhole.cs | 4 ++++ .../TorrentBlackhole/TorrentBlackholeSettings.cs | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackhole.cs b/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackhole.cs index 852dd0423..9eb47f982 100644 --- a/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackhole.cs +++ b/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackhole.cs @@ -103,6 +103,8 @@ public override IEnumerable GetItems() historyItem.RemainingTime = TimeSpan.Zero; } + historyItem.IsReadOnly = Settings.ReadOnly; + yield return historyItem; } @@ -132,6 +134,8 @@ public override IEnumerable GetItems() historyItem.RemainingTime = TimeSpan.Zero; } + historyItem.IsReadOnly = Settings.ReadOnly; + yield return historyItem; } } diff --git a/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackholeSettings.cs b/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackholeSettings.cs index 5d953396e..4e930255f 100644 --- a/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackholeSettings.cs +++ b/src/NzbDrone.Core/Download/Clients/TorrentBlackhole/TorrentBlackholeSettings.cs @@ -1,5 +1,6 @@ -using FluentValidation; -using System; +using System.ComponentModel; +using FluentValidation; +using Newtonsoft.Json; using NzbDrone.Core.Annotations; using NzbDrone.Core.ThingiProvider; using NzbDrone.Core.Validation; @@ -18,6 +19,11 @@ public TorrentBlackholeSettingsValidator() public class TorrentBlackholeSettings : IProviderConfig { + public TorrentBlackholeSettings() + { + ReadOnly = true; + } + private static readonly TorrentBlackholeSettingsValidator Validator = new TorrentBlackholeSettingsValidator(); [FieldDefinition(0, Label = "Torrent Folder", Type = FieldType.Path, HelpText = "Folder in which Sonarr will store the .torrent file")] @@ -26,6 +32,11 @@ public class TorrentBlackholeSettings : IProviderConfig [FieldDefinition(1, Label = "Watch Folder", Type = FieldType.Path, HelpText = "Folder from which Sonarr should import completed downloads")] public string WatchFolder { get; set; } + [DefaultValue(false)] + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] + [FieldDefinition(2, Label = "Read Only", Type = FieldType.Checkbox, HelpText = "Instead of moving files this will instruct Sonarr to Copy or Hardlink (depending on settings/system configuration)")] + public bool ReadOnly { get; set; } + public NzbDroneValidationResult Validate() { return new NzbDroneValidationResult(Validator.Validate(this));