private bool GetDownloadLink(DownloadFile_v1 <TKey> downloadFile) { downloadFile.downloadLink = _debrider.DebridLink(downloadFile.downloadLinks); if (downloadFile.downloadLink != null) { downloadFile.file += zurl.GetExtension(downloadFile.downloadLink); return(true); } else { return(false); } }
private bool DebridLink(QueueDownloadFile queueDownloadFile, DownloadItemLink itemLink, DownloadServerLink serverLink, DownloadFilePartLink filePartLink, out string debridedLink, out string file) { if (!filePartLink.Debrided) { // http://s19.alldebrid.com/dl/f3nmdg2f05/Herc-FULLBluRay.part01.rar debridedLink = _debrider.DebridLink(filePartLink.DownloadLink); filePartLink.Debrided = true; queueDownloadFile.Modified = true; if (debridedLink != null) { filePartLink.DebridedDownloadLink = debridedLink; //file = queueDownloadFile.File; file = queueDownloadFile.Filename; string urlFileName = zPath.GetFileName(zurl.GetAbsolutePath(debridedLink)); if (file == null) { file = zPath.GetFileNameWithoutExtension(urlFileName); } if (queueDownloadFile.DownloadItemLinks.Length > 1) { file += "_" + itemLink.Name; } if (serverLink.FilePartLinks.Length > 1) { //file += ZipManager.GetZipFilePartName(zurl.GetFileName(debridedLink)); //file += ZipManager.GetZipFilePartName(urlFileName); file += ZipArchive.GetZipFilePartName(urlFileName); } //file += zurl.GetExtension(debridedLink); file += zPath.GetExtension(urlFileName); if (queueDownloadFile.Directory != null) { file = zPath.Combine(queueDownloadFile.Directory, file); } filePartLink.File = file; if (_trace) { pb.Trace.WriteLine("DownloadManager.DebridLink() 01 : _debrider.DebridLink(\"{0}\") : \"{1}\"", filePartLink.DownloadLink, debridedLink); } return(true); } } debridedLink = null; file = null; return(false); }
public static void DownloadFile(string url, string directory = null, bool startNow = false, string parameters = null) { //NamedValues<ZValue> parameters2 = NamedValues.ParseValues(parameters); NamedValues <ZValue> parameters2 = ParseParameters(parameters); DownloadManagerClientBase downloadManagerClient = DownloadAutomateManagerCreator.CreateDownloadManagerClient(GetDownloadAutomateManagerConfig(GetTestValue(parameters2))); Debrider debrider = DownloadAutomateManagerCreator.CreateDebrider(XmlConfig.CurrentConfig); url = debrider.DebridLink(url); Uri uri = new Uri(url); string file = uri.Segments[uri.Segments.Length - 1]; if (directory != null) { file = zPath.Combine(directory, file); } downloadManagerClient.AddDownload(url, file, startNow: startNow); }