Kodi Community Forum
WebServer HTTP API (HttpApi): for PocketPC and Web-client Remote Control Apps - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: WebServer HTTP API (HttpApi): for PocketPC and Web-client Remote Control Apps (/showthread.php?tid=8760)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38


- Kick In Da Door - 2005-12-01

i think i give up, think i tried everything u listed except im not sure on the dhcp static ip thing, when i changed to static xbox couldnt connect to internet , what do i put in the dns settings? here is my debug again.

12/1/2005 11:55:22 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=getcurrentplaylist
-------------
12/1/2005 11:55:22 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:22 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=getdirectory&parameter=e%3a%5cmy+music%5c
-------------
12/1/2005 11:55:22 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:33 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=setcurrentplaylist&parameter=0
-------------
12/1/2005 11:55:33 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:34 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=config&parameter=getoption;pictureextensions
-------------
12/1/2005 11:55:34 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:34 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=config&parameter=getoption;videoextensions
-------------
12/1/2005 11:55:34 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:34 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=config&parameter=getoption;musicextensions
-------------
12/1/2005 11:55:34 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:34 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=setautogetpicturethumbs&parameter=false
-------------
12/1/2005 11:55:34 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:34 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=setcurrentplaylist&parameter=0
-------------
12/1/2005 11:55:34 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:34 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=getplaylistcontents
-------------
12/1/2005 11:55:34 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:34 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=getguidescription
-------------
12/1/2005 11:55:34 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:36 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=setcurrentplaylist&parameter=0
-------------
12/1/2005 11:55:36 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:36 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=config&parameter=getoption;pictureextensions
-------------
12/1/2005 11:55:36 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:37 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=config&parameter=getoption;videoextensions
-------------
12/1/2005 11:55:37 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:37 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=config&parameter=getoption;musicextensions
-------------
12/1/2005 11:55:37 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:37 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=setautogetpicturethumbs&parameter=false
-------------
12/1/2005 11:55:37 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:37 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=setcurrentplaylist&parameter=0
-------------
12/1/2005 11:55:37 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:37 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=getplaylistcontents
-------------
12/1/2005 11:55:37 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------
12/1/2005 11:55:37 am -- getpage:http://192.168.2.70/xbmccmds/xbmchttp?command=getguidescription
-------------
12/1/2005 11:55:37 am -- getpagegeneralexception: the type initializer for "system.net.httpwebrequest" threw an exception.
-------------


- nad - 2005-12-01

kick in da door:

try deleting xbmccontrol.exe.config.

if that fixes things then you have an old version of .net installed.

if it does not fix it, send me a private message.

nad


- Kick In Da Door - 2005-12-02

(nad @ dec. 01 2005,19:47 Wrote:kick in da door:

try deleting xbmccontrol.exe.config.

if that fixes things then you have an old version of .net installed.

if it does not fix it, send me a private message.

nad
finally it worked,that did the trick , and this is seriously a good prgram to, thanx for ur help.
u planning anything else withthis program?


- nad - 2005-12-03

good to see that you got it working.

i don't have any current plans for my client apart from maybe adding a .net version check at start up! the main reason for creating the client was as a demo of how to use my httpapi. i was hoping people with more creative/gui skills than me would use the api to create really impressive front-ends to xbmc. this is why i have also provided interfaces to the api through vb6, xbmc's python and asp, as well as even an excel client. i'm still hoping that this will happen.

nad


- LiquidIce629 - 2005-12-03

hi nad, great work on the api. i am currently developing a macromedia flash frontend for the xbox media center, and i'm having some trouble with the asp headers.

as some of the posts above describe, i'm getting the http headers mixed in with the output of the page.

http/1.0 200 ok server: goahead-webs pragma: no-cache cache-control: no-cache content-type: text/html

having this text at the top of every http request is making it hard if not impossible to parse the output in flash.

you said you posted a fix, but i'm not sure how i can get it. i do not have the tools or resources to make my own build of xbmc.

is there a config file somewhere that i can edit, or does it have to be recompiled?

i have most of the functionality working through the url calls, but there are some things that i will need to use asp for, such as getting file listings.


::edit::
i got it working using some ugly workaround code.. here it what it takes to bring the xbmc file listing into flash:

Quote:function getfilelisting(){

xbmcfilesystem = new loadvars();
xbmcfilesystem.onload=function(){
trace("xbmcfilesystem got: "+ unescape(this.tostring()));

//clean up bogus <html> code - why does the api output these?? if i wanted them in there i would have typed them myself.
//this isn't even really html in the first place...
cleanup = unescape(this.tostring());
cleanup=cleanup.slice(8);
cleanup2 = cleanup.split("</html>");

trace("clean code:"+cleanup2[0]);

myfilesys = cleanup2[0].split("<li>");

for(k=0;k<myfilesys.length;k++){
if(myfilesys[k] != ""){

thislisting = myfilesys[k].split(" ;");
trace("adding to data list:"+thislisting[0]);

//this is some custom code that inserts each file/folder into a list on my interface
_root.filesystem.trackcell.duplicatemovieclip("trackcell"+k, 1000+k);
_root.filesystem["trackcell"+k]._x = 0;
_root.filesystem["trackcell"+k]._y = 0 + (k*33);
_root.filesystem["trackcell"+k].trackname.text = thislisting[0];
_root.filesystem["trackcell"+k].trackid.text = k;
}
}

};
xbmcfilesystem.parameter="f:";
xbmcfilesystem.command="getdirectory";
xbmcfilesystem.sendandload("http://192.168.1.201:8081/xbmccmds/xbmchttp", xbmcfilesystem, "get");
trace("sending rpc call:"+xbmcfilesystem.tostring());
}

although it would still be nice to get the http header fix for the asp scripts.






- Drongo - 2005-12-05

liquidice629, i think nad sorted out the troublesome header info a couple of weeks ago and seems to work for me.

nad & guys - some help please. the goahead web server has a very limited number of commands so i have resorted to use javascript. does anyone know why it has such few commands? problem is that nad's functions only work from an http link or from asp or from a python script. is there any way that i can get the  'getcurrentlyplaying' info info a javascript variable so i can then parse the info etc using javascript?


- LiquidIce629 - 2005-12-10

i'm still having problems with the http headers, so your going to have to write some cleanup code like i did in flash above. the following javascript code is an example on how you can get data to and from the web server. it should get you started:

Quote:<script>
// send request to webserver for data
var url = "http://192.168.1.201:8081/xbmccmds/xbmchttp?command=getdirectory&parameter=f:";

mydata = "";


//connection code
var xmlhttp = null;
try {
xmlhttp = new activexobject("msxml2.xmlhttp");
} catch (e) {
try {
xmlhttp = new activexobject("microsoft.xmlhttp");
} catch (e) {
try {
xmlhttp = new xmlhttprequest();
} catch (e) {
xmlhttp = false;
}
}
}
if (!xmlhttp && typeof xmlhttprequest!='undefined') {
xmlhttp = new xmlhttprequest();
}
var getfiles = new xmlhttprequest();
xmlhttp.onreadystatechange = function getresponse(aevt)
{
if (xmlhttp.readystate == 4)
{
var qs = xmlhttp.responsetext;
alert(xmlhttp.responsetext);
//lots of fun parsing
}
};


xmlhttp.open("get", url, true);
xmlhttp.send(mydata);
</script>






- Drongo - 2005-12-12

liquidice629,

thanks for the reply. i am a novice web designer but have managed to get some early code to work without returning the header info.

i have use the following target to load an asp page:-

Quote:<a href="ppcxbmc-trackinfo.asp" target="contentframe"><img src="images/trackinfo.gif" alt="" height="20" width="20" border="0" valign="top" align="left"></a>

the asp page contains:-

Quote:<html>
<head>
<title>xbox media center for ppc - trackinfo</title>
<script src="xbmclib.js" type="text/javascript" language="javascript1.2"></script>
<style>
p {
font: 10pt arial; color:#0000ff;
}
</style>
</head>

<body bgcolor="#ff9966"  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<%
var info;
write("<p>trackinfo</p>");
info=xbmcapi("getcurrentlyplaying");
write("<p>" + info + "</p>");
%>

</body>
</html>

maybe this will help


- nad - 2005-12-12

drongo: thanks that's how i had envisaged the api being used.

to help out users like liquidice629 i'm thinking about adding a command that will allow customisation of the format of the response e.g. turn off headers; open tag="..."; close tag="...".


- Drongo - 2005-12-13

nad, the only problem with using the 'xbmcapi' commands in 'asp' is that the goahead web server only has about 5 commands. therefore you can only really display the info returned in the format that you added. i have started to use the xmlhttp response object to get the info from the xbox, parse it and display it nicely using javascript. i'm using javascript cos i'm only really interested in using a pda - don't see a need to use a desktop pc to manipulate the xbmc. i gues liquidice is using flash for a pc based app and he's much more experienced than i.

what would really make life easier is if the web server had a full implementation of embedded javascript.


- Kick In Da Door - 2005-12-13

wish i knew what u guys are talkin about , can u please explain, and how i can use it


- incognegro - 2005-12-17

(kick in da door @ dec. 13 2005,20:46 Wrote:wish i knew what u guys are talkin about , can u please explain, and how i can use it
just go back to the front page and download the program......follow the instructions and u'll figure it out. as for what theyre talking about, don't try too hard to figure it out; theyre justtrying to make some web based versions of the same app and unless your a web developer or know some simple web design then you wont get it.


now i have a couple problems with the program itself........im usingthe desktop version and in the keys tab, the up direction doesnt work at all and the new multipath bookmarks option doesnt work with this app, it only shows the contents of the root when browsing through the contents of the bookmark. i noticed there is a clipboard option to post links, but how do i use it? im very interested in this feature and all i see is the "play clipboard" feature but i dont know where the clipboard is for me to paste links to it :help:






- kraqh3d - 2005-12-17

funny you should mention the multipath bookmarks. i tried to investigate that, but i cant get the pc app to work. it wont connect to my xbox ip address. and i know my xbox is listening on 80 because i can open up the classic web control.

i ran ethereal to analyse what was going on, and i see no ip based communication what-so-ever to my xbox. and i see the following error in config tab: "err: the type initializer for "system.net.httpwebrequest" threw an exception."

any ideas?


- Kick In Da Door - 2005-12-18

(kraqh3d @ dec. 17 2005,15:40 Wrote:funny you should mention the multipath bookmarks.  i tried to investigate that, but i cant get the pc app to work.  it wont connect to my xbox ip address.  and i know my xbox is listening on 80 because i can open up the classic web control.

i ran ethereal to analyse what was going on, and i see no ip based communication what-so-ever to my xbox.  and i see the following error in config tab:  "err: the type initializer for "system.net.httpwebrequest" threw an exception."

any ideas?
yea,

delete everything , and unzip the program again , then go into the pc/dekstop folder of the program and delete xbmccontrol.exe.config file then launch the prgram , it should work, beforeu do any that make sure u go .net framework installed.


- kraqh3d - 2005-12-18

cool. that worked... first off, it's rather bad that it gets the bookmark listing from xboxmediacenter.xml and not from xbmc as its running. this will lead to a few problems...

multipath bookmarks definately wont work as they use an internal protocol to mark them as such. and special directory tags like $screenshots wont work either. both of these bookmark types are processed by xbmc and the paths converted as xboxmediacenter.xml is read in.

also, samba paths of smb://domain;user:pass@someserver/share/path just dont seem to work at all.