XBMC API improvements

This commit is contained in:
Mark McDowall 2014-05-10 19:52:19 -07:00
parent 42101d302b
commit 3c47df8691
3 changed files with 4 additions and 3 deletions

View File

@ -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);

View File

@ -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;
}

View File

@ -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());