core: generate magnet link from infohash and vice versa. resolves #8590 (#10087)

* global list of public trackers
* infohash => magnet link (only in public trackers)
* magnet link => infohash
This commit is contained in:
Diego Heras
2020-11-02 17:43:13 +01:00
committed by GitHub
parent 9bd8f4d014
commit 14fdea164c
5 changed files with 141 additions and 1 deletions

View File

@@ -296,6 +296,14 @@ namespace Jackett.Common.Indexers
if (r.PublishDate > DateTime.Now)
r.PublishDate = DateTime.Now;
// generate magnet link from info hash (not allowed for private sites)
if (r.MagnetUri == null && !string.IsNullOrWhiteSpace(r.InfoHash) && Type != "private")
r.MagnetUri = MagnetUtil.InfoHashToPublicMagnet(r.InfoHash, r.Title);
// generate info hash from magnet link
if (r.MagnetUri != null && string.IsNullOrWhiteSpace(r.InfoHash))
r.InfoHash = MagnetUtil.MagnetToInfoHash(r.MagnetUri);
return r;
});
return fixedResults;