New: (Torznab) Add `magneturl' attribute

pull/1800/head
Bogdan 9 months ago
parent 0463e66881
commit 1d345b9764

@ -85,7 +85,7 @@ namespace NzbDrone.Core.IndexerSearch
r.InfoUrl == null ? null : new XElement("comments", r.InfoUrl),
r.PublishDate == DateTime.MinValue ? new XElement("pubDate", XmlDateFormat(DateTime.Now)) : new XElement("pubDate", XmlDateFormat(r.PublishDate)),
new XElement("size", r.Size),
new XElement("link", r.DownloadUrl ?? t.MagnetUrl ?? string.Empty),
new XElement("link", r.DownloadUrl ?? string.Empty),
r.Categories == null ? null : from c in r.Categories select new XElement("category", c.Id),
new XElement(
"enclosure",
@ -115,6 +115,7 @@ namespace NzbDrone.Core.IndexerSearch
GetNabElement("label", RemoveInvalidXMLChars(r.Label), protocol),
GetNabElement("track", RemoveInvalidXMLChars(r.Track), protocol),
GetNabElement("infohash", RemoveInvalidXMLChars(t.InfoHash), protocol),
GetNabElement("magneturl", t.MagnetUrl, protocol),
GetNabElement("minimumratio", t.MinimumRatio, protocol),
GetNabElement("minimumseedtime", t.MinimumSeedTime, protocol),
GetNabElement("downloadvolumefactor", t.DownloadVolumeFactor, protocol),

@ -184,9 +184,11 @@ namespace NzbDrone.Api.V1.Indexers
{
result.DownloadUrl = result.DownloadUrl.IsNotNullOrWhiteSpace() ? _downloadMappingService.ConvertToProxyLink(new Uri(result.DownloadUrl), request.server, indexerDef.Id, result.Title).AbsoluteUri : null;
if (result.DownloadProtocol == DownloadProtocol.Torrent)
if (result.DownloadProtocol == DownloadProtocol.Torrent &&
result is TorrentInfo torrentRelease &&
torrentRelease.MagnetUrl.IsNotNullOrWhiteSpace())
{
((TorrentInfo)result).MagnetUrl = ((TorrentInfo)result).MagnetUrl.IsNotNullOrWhiteSpace() ? _downloadMappingService.ConvertToProxyLink(new Uri(((TorrentInfo)result).MagnetUrl), request.server, indexerDef.Id, result.Title).AbsoluteUri : null;
result.DownloadUrl ??= _downloadMappingService.ConvertToProxyLink(new Uri(torrentRelease.MagnetUrl), request.server, indexerDef.Id, torrentRelease.Title).AbsoluteUri;
}
}

Loading…
Cancel
Save