mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 10:47:08 -07:00
New: NzbDrone service to automatically report errors and episode parse issues.
This commit is contained in:
parent
ea86ce2fcb
commit
174f765ec9
140 changed files with 10774 additions and 1694 deletions
|
@ -113,5 +113,40 @@ namespace NzbDrone.Core.Providers.Core
|
|||
|
||||
return responseFromServer.Replace(" ", " ");
|
||||
}
|
||||
|
||||
public virtual string Post(string address, string command, string username, string password)
|
||||
{
|
||||
Logger.Trace("Posting command: {0}, to {1}", command, address);
|
||||
|
||||
byte[] byteArray = Encoding.ASCII.GetBytes(command);
|
||||
|
||||
var request = (HttpWebRequest)WebRequest.Create(address);
|
||||
request.Method = "POST";
|
||||
request.Credentials = new NetworkCredential(username, password);
|
||||
request.ContentType = "application/json";
|
||||
request.Timeout = 2000;
|
||||
request.KeepAlive = false;
|
||||
|
||||
//Used to hold the JSON response
|
||||
string responseFromServer;
|
||||
|
||||
using (var requestStream = request.GetRequestStream())
|
||||
{
|
||||
requestStream.Write(byteArray, 0, byteArray.Length);
|
||||
|
||||
using (var response = request.GetResponse())
|
||||
{
|
||||
using (var responseStream = response.GetResponseStream())
|
||||
{
|
||||
using (var reader = new StreamReader(responseStream))
|
||||
{
|
||||
responseFromServer = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return responseFromServer.Replace(" ", " ");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue