XBMC API improvements

pull/79/merge
Mark McDowall 11 years ago
parent 42101d302b
commit 3c47df8691

@ -15,7 +15,6 @@ namespace NzbDrone.Common
string DownloadString(string url, string username, string password);
string DownloadString(string url, ICredentials credentials);
Dictionary<string, string> GetHeader(string url);
Stream DownloadStream(string url, NetworkCredential credential = null);
void DownloadFile(string url, string fileName);
string PostCommand(string address, string username, string password, string command);
@ -33,6 +32,7 @@ namespace NzbDrone.Common
{
_logger = logger;
_userAgent = String.Format("NzbDrone {0}", BuildInfo.Version);
ServicePointManager.Expect100Continue = false;
}
public string DownloadString(string url)
@ -134,6 +134,7 @@ namespace NzbDrone.Common
var wc = new WebClient();
wc.Credentials = new NetworkCredential(username, password);
var response = wc.UploadData(address, "POST", byteArray);
var text = Encoding.ASCII.GetString(response);

@ -214,7 +214,7 @@ namespace NzbDrone.Core.Notifications.Xbmc
postJson.Add(new JProperty("params", parameters));
}
postJson.Add(new JProperty("id", 10));
postJson.Add(new JProperty("id", DateTime.Now.Ticks));
return postJson;
}

@ -57,7 +57,7 @@ namespace NzbDrone.Core.Notifications.Xbmc
var postJson = new JObject();
postJson.Add(new JProperty("jsonrpc", "2.0"));
postJson.Add(new JProperty("method", "JSONRPC.Version"));
postJson.Add(new JProperty("id", 10));
postJson.Add(new JProperty("id", DateTime.Now.Ticks));
var response = _httpProvider.PostCommand(settings.Address, settings.Username, settings.Password, postJson.ToString());

Loading…
Cancel
Save