HttpProvider - Added Download File.

SabProvider - Added AddById (Newzbin)
Fixes to RssItemProcessingProvider
Can either download NZB to file or send to SAB...
This commit is contained in:
Mark McDowall 2011-03-21 20:51:03 -07:00
commit 4f2f5a3d71
11 changed files with 240 additions and 75 deletions

View file

@ -39,5 +39,40 @@ namespace NzbDrone.Core.Providers
return String.Empty;
}
public bool DownloadFile(string request, string filename)
{
try
{
var webClient = new WebClient();
webClient.DownloadFile(request, filename);
return true;
}
catch (Exception ex)
{
Logger.Warn("Failed to get response from: {0}", request);
Logger.TraceException(ex.Message, ex);
}
return false;
}
public bool DownloadFile(string request, string filename, string username, string password)
{
try
{
var webClient = new WebClient();
webClient.Credentials = new NetworkCredential(username, password);
webClient.DownloadFile(request, filename);
return true;
}
catch (Exception ex)
{
Logger.Warn("Failed to get response from: {0}", request);
Logger.TraceException(ex.Message, ex);
}
return false;
}
}
}