public override bool Go(TVRenameStats stats) { try { if (!(TVSettings.Instance.CheckuTorrent || TVSettings.Instance.CheckqBitTorrent)) { Error = true; ErrorText = "No torrent clients enabled to download RSS"; Done = true; return(false); } if (!TVSettings.Instance.qBitTorrentDownloadFilesFirst && TVSettings.Instance.CheckqBitTorrent) { qBitTorrentFinder.StartTorrentDownload(url, null, false); Done = true; return(true); } byte[] r = HttpHelper.GetUrlBytes(url, true); if (r is null || r.Length == 0) { Error = true; ErrorText = "No data downloaded"; Done = true; return(false); } string saveTemp = SaveDownloadedData(r, SourceName); if (TVSettings.Instance.CheckuTorrent) { uTorrentFinder.StartTorrentDownload(saveTemp, theFileNoExt); } if (TVSettings.Instance.CheckqBitTorrent) { qBitTorrentFinder.StartTorrentDownload(url, saveTemp, TVSettings.Instance.qBitTorrentDownloadFilesFirst); } Done = true; return(true); } catch (Exception e) { ErrorText = e.Message; LastError = e; Error = true; Done = true; return(false); } }
private FileInfo DownloadFile() { byte[] r = HttpHelper.GetUrlBytes(url, true); if (r.Length == 0) { throw new DownloadFailedException(); } string saveTemp = SaveDownloadedData(r, SourceName); FileInfo downloadedFile = new FileInfo(theFileNoExt + saveTemp); return(downloadedFile); }
public override ActionOutcome Go(TVRenameStats stats) { try { if (!(TVSettings.Instance.CheckuTorrent || TVSettings.Instance.CheckqBitTorrent)) { return(new ActionOutcome("No torrent clients enabled to download RSS")); } if (!TVSettings.Instance.qBitTorrentDownloadFilesFirst && TVSettings.Instance.CheckqBitTorrent) { qBitTorrentFinder.StartTorrentDownload(url, null, false); return(ActionOutcome.Success()); } byte[] r = HttpHelper.GetUrlBytes(url, true); if (r is null || r.Length == 0) { return(new ActionOutcome($"No data downloaded from {url}")); } string saveTemp = SaveDownloadedData(r, SourceName); if (TVSettings.Instance.CheckuTorrent) { uTorrentFinder.StartTorrentDownload(saveTemp, theFileNoExt); } if (TVSettings.Instance.CheckqBitTorrent) { qBitTorrentFinder.StartTorrentDownload(url, saveTemp, TVSettings.Instance.qBitTorrentDownloadFilesFirst); } return(ActionOutcome.Success()); } catch (Exception e) { return(new ActionOutcome(e)); } }