private async void setContent(Torrent torrent) { wb.NavigateToString("Description downloading..."); TorrentDetail details = await T411Service.Details(int.Parse(torrent.Id)); wb.NavigateToString(details.Description); }
public async Task <DownloadRequestResultModel> Download(string siteId, string relativeUrl) { Site site = SiteProvider.GetById(siteId) ?? throw new ArgumentException("Unknown site: " + siteId); TorrentDetail detail = _torrentFinder.GetTorrentDetail(site, relativeUrl); Torrent t = await _delugedConnection.Daemon.AddTorrentMagnetAsync(detail.MagnetLinks.ElementAt(0)); return(new DownloadRequestResultModel()); }
/// <summary> /// Get the detail of a particular torrent. /// </summary> /// <param name="id">The id of the torrent</param> /// <returns>A TorrentDetail object containing an HTML formatted description</returns> public static async Task <TorrentDetail> Details(int id) { using (var httpClient = new HttpClient()) { httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Authorization", TOKEN); string strResult = await httpClient.GetStringAsync($"{HOST_NAME}/torrents/details/{id}"); JObject result = JsonConvert.DeserializeObject(strResult) as JObject; TorrentDetail torrentDetail = result.ToObject <TorrentDetail>(); return(torrentDetail); } }