mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-27 20:44:00 +02:00
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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user