You've already forked Sonarr
mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-11-06 09:19:38 +02:00
added more tests for seriesprovider
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Xml;
|
||||
using NLog;
|
||||
|
||||
namespace NzbDrone.Core.Providers.Core
|
||||
@@ -40,39 +41,43 @@ namespace NzbDrone.Core.Providers.Core
|
||||
return String.Empty;
|
||||
}
|
||||
|
||||
public bool DownloadFile(string request, string filename)
|
||||
public void 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);
|
||||
throw;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
public bool DownloadFile(string request, string filename, string username, string password)
|
||||
public void 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);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
public XmlReader DownloadXml(string url)
|
||||
{
|
||||
return XmlReader.Create(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,13 @@
|
||||
namespace NzbDrone.Core.Providers.Core
|
||||
using System.Xml;
|
||||
|
||||
namespace NzbDrone.Core.Providers.Core
|
||||
{
|
||||
public interface IHttpProvider
|
||||
{
|
||||
string DownloadString(string request);
|
||||
string DownloadString(string request, string username, string password);
|
||||
bool DownloadFile(string request, string filename);
|
||||
bool DownloadFile(string request, string filename, string username, string password);
|
||||
void DownloadFile(string request, string filename);
|
||||
void DownloadFile(string request, string filename, string username, string password);
|
||||
XmlReader DownloadXml(string url);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user