示例#1
0
void NZBGet::ProcessWebGet()
{
	WebDownloader downloader;
	downloader.SetUrl(m_commandLineParser->GetLastArg());
	downloader.SetForce(true);
	downloader.SetRetry(false);
	downloader.SetOutputFilename(m_commandLineParser->GetWebGetFilename());
	downloader.SetInfoName("WebGet");

	WebDownloader::EStatus status = downloader.DownloadWithRedirects(5);
	bool ok = status == WebDownloader::adFinished;

	exit(ok ? 0 : 1);
}
示例#2
0
void ProcessWebGet()
{
	WebDownloader downloader;
	downloader.SetURL(g_pOptions->GetLastArg());
	downloader.SetForce(true);
	downloader.SetRetry(false);
	downloader.SetOutputFilename(g_pOptions->GetWebGetFilename());
	downloader.SetInfoName("WebGet");

	int iRedirects = 0;
	WebDownloader::EStatus eStatus = WebDownloader::adRedirect;
	while (eStatus == WebDownloader::adRedirect && iRedirects < 5)
	{
		iRedirects++;
		eStatus = downloader.Download();
	}
	bool bOK = eStatus == WebDownloader::adFinished;

	exit(bOK ? 0 : 1);
}