Hello,
My goal is to develop an add-on for XBMC from which I can watch Live TV through DVBLink, very much like the Boxee app.
But my knowledge of developing XBMC add-ons are very limited so I'm not quite sure how far I will get...
In order to get this working I first have to familiarize myself with the DvbLink Remote API.
Since I'm a C# developer my first step is to the get the API working in familiar surroundings, so I started with a sample application in C# which use the Dvblink Remote Api...
But I've not been able to connect to my Dvblink server, it returns error 401 - permission denied.
I've included the sample code which I use, perhaps you can spot if I'm doing something wrong when calling the API.
The documentation for the Dvblink Remote API has version 0.1, are there any plans to update this documentation with some more info?
Start of sample code
private string GetResponse(string url)
{
// Create request for the web stream
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
string username = "user";
string password = "test";
string usernamePassword = username + ":" + password;
req.ContentType = "application/x-www-form-urlencoded";
CredentialCache mycache = new CredentialCache();
mycache.Add(new Uri(url), "Basic", new NetworkCredential(username, password));
req.Credentials = mycache;
req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(new ASCIIEncoding().GetBytes(usernamePassword)));
// Return request in a response stream
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.UTF8);
return sr.ReadToEnd();
}
private void button1_Click(object sender, EventArgs e)
{
string url = "http://htpc:8080/cs/command=get_channels";
string result = GetResponse(url);
textBox1.Text = result;
}
End of sample code
Regards
/Mattias