mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-27 02:43:57 +02:00
XBMC Library updates should be more reliable now
This commit is contained in:
parent
e426a1967f
commit
a2e7f9ecbb
3
.gitignore
vendored
3
.gitignore
vendored
@ -47,4 +47,5 @@ NzbDrone.Web/MediaCover
|
||||
NzbDrone.fpr
|
||||
nzbdrone.log*txt
|
||||
_rawPackage_service/
|
||||
_NCrunch_*
|
||||
_NCrunch_*
|
||||
_TeamCity*
|
@ -93,35 +93,12 @@ public virtual string PostCommand(string address, string username, string passwo
|
||||
|
||||
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 = 20000;
|
||||
request.KeepAlive = false;
|
||||
var wc = new WebClient();
|
||||
wc.Credentials = new NetworkCredential(username, password);
|
||||
var response = wc.UploadData(address, "POST", byteArray);
|
||||
var text = Encoding.ASCII.GetString(response);
|
||||
|
||||
//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(" ", " ");
|
||||
return text.Replace(" ", " ");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user