public async Task Unrestrict(Guid torrentId) { var torrent = await _torrentData.GetById(torrentId); var rdTorrent = await GetRdNetClient().GetTorrentInfoAsync(torrent.RdId); foreach (var link in rdTorrent.Links) { var unrestrictedLink = await GetRdNetClient().UnrestrictLinkAsync(link); if (torrent.Downloads.Any(m => m.Link == unrestrictedLink.Download)) { continue; } await _downloads.Add(torrent.TorrentId, unrestrictedLink.Download); } }
public async Task Download(Guid id) { var torrent = await _torrentData.GetById(id); await _downloads.DeleteForTorrent(id); await _torrentData.UpdateStatus(id, TorrentStatus.DownloadQueued); var rdTorrent = await RdNetClient.GetTorrentInfoAsync(torrent.RdId); var existingDownloads = await _downloads.GetForTorrent(id); foreach (var link in rdTorrent.Links) { var unrestrictedLink = await RdNetClient.UnrestrictLinkAsync(link); if (existingDownloads.Any(m => m.Link == unrestrictedLink.Download)) { continue; } await _downloads.Add(torrent.TorrentId, unrestrictedLink.Download); } }