mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-26 22:46:37 -04:00
New: Choose extension for magnet links in Torrent Blackhole
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com>
This commit is contained in:
@@ -49,7 +49,7 @@ namespace NzbDrone.Core.Download.Clients.Blackhole
|
||||
|
||||
title = FileNameBuilder.CleanFileName(title);
|
||||
|
||||
var filepath = Path.Combine(Settings.TorrentFolder, string.Format("{0}.magnet", title));
|
||||
var filepath = Path.Combine(Settings.TorrentFolder, $"{title}.{Settings.MagnetFileExtension.Trim('.')}");
|
||||
|
||||
var fileContent = Encoding.UTF8.GetBytes(magnetLink);
|
||||
using (var stream = _diskProvider.OpenWriteStream(filepath))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel;
|
||||
using FluentValidation;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Core.Annotations;
|
||||
@@ -14,6 +14,7 @@ namespace NzbDrone.Core.Download.Clients.Blackhole
|
||||
{
|
||||
//Todo: Validate that the path actually exists
|
||||
RuleFor(c => c.TorrentFolder).IsValidPath();
|
||||
RuleFor(c => c.MagnetFileExtension).NotEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +22,7 @@ namespace NzbDrone.Core.Download.Clients.Blackhole
|
||||
{
|
||||
public TorrentBlackholeSettings()
|
||||
{
|
||||
MagnetFileExtension = ".magnet";
|
||||
ReadOnly = true;
|
||||
}
|
||||
|
||||
@@ -34,12 +36,15 @@ namespace NzbDrone.Core.Download.Clients.Blackhole
|
||||
|
||||
[DefaultValue(false)]
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
[FieldDefinition(2, Label = "Save Magnet Files", Type = FieldType.Checkbox, HelpText = "Save a .magnet file with the magnet link if no .torrent file is available (only useful if the download client supports .magnet files)")]
|
||||
[FieldDefinition(2, Label = "Save Magnet Files", Type = FieldType.Checkbox, HelpText = "Save the magnet link if no .torrent file is available (only useful if the download client supports magnets saved to a file)")]
|
||||
public bool SaveMagnetFiles { get; set; }
|
||||
|
||||
[FieldDefinition(3, Label = "Magnet File Extension", Type = FieldType.Textbox, HelpText = "Extension to use for magnet links, defaults to '.magnet'")]
|
||||
public string MagnetFileExtension { get; set; }
|
||||
|
||||
[DefaultValue(false)]
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
[FieldDefinition(3, Label = "Read Only", Type = FieldType.Checkbox, HelpText = "Instead of moving files this will instruct Lidarr to Copy or Hardlink (depending on settings/system configuration)")]
|
||||
[FieldDefinition(4, Label = "Read Only", Type = FieldType.Checkbox, HelpText = "Instead of moving files this will instruct Lidarr to Copy or Hardlink (depending on settings/system configuration)")]
|
||||
public bool ReadOnly { get; set; }
|
||||
|
||||
public NzbDroneValidationResult Validate()
|
||||
|
||||
Reference in New Issue
Block a user