Skip to content

Commit

Permalink
New: (Torznab) Add Prefer Magnet URL option
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan committed Jul 28, 2023
1 parent 269dc56 commit 02a5482
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ protected override ReleaseInfo ProcessItem(XElement item, ReleaseInfo releaseInf
torrentInfo.IndexerFlags = GetFlags(item);
torrentInfo.PosterUrl = GetPosterUrl(item);
torrentInfo.InfoHash = GetInfoHash(item);

if (_settings.PreferMagnetUrl && torrentInfo.MagnetUrl.IsNotNullOrWhiteSpace())
{
torrentInfo.DownloadUrl = torrentInfo.MagnetUrl;
}
}

return torrentInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,15 @@ public class TorznabSettings : NewznabSettings, ITorrentIndexerSettings
{
private static readonly TorznabSettingsValidator Validator = new ();

[FieldDefinition(3)]
public TorznabSettings()
{
PreferMagnetUrl = false;
}

[FieldDefinition(3, Label = "Prefer Magnet URL", HelpText = "If checked, Magnet URLs when available will be preferred over Torrent Files", Type = FieldType.Checkbox, Advanced = true)]
public bool PreferMagnetUrl { get; set; }

[FieldDefinition(4)]
public IndexerTorrentBaseSettings TorrentBaseSettings { get; set; } = new ();

public override NzbDroneValidationResult Validate()
Expand Down

0 comments on commit 02a5482

Please sign in to comment.