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


- nad - 2006-07-03

mfennell: the image starts off as a jpeg but then i convert it to base64 so as to be able to pass it over the text only http stream. i'm not aware of another way of doing this - any thoughts from anyone?

to get at the jpeg you can either:

1. open an ftp session from your interface and download the jpeg that way
2. write a base64 to binary routine in your client. this isn't difficult and i'm sure you can find implementations in different programming languages on the internet.

i would suggest option 2 is the better approach but i don't know how easy either approch is in flash.


- mfennell - 2006-07-04

thanks for the clarification there. flash isnt good at number crunching, and with tryingto do it on the psp even more limited so.

my temporary solution has been to copy the whole thumbnails directpry from q: over to c:web\ and access through there. its looking promising and i then i guess i can have a pythin script that copies all the thumbnails across either manually run (or somehow triggered after the scan all to database optionHuh)

ill also try the ftp approach... that could work too.

cheers
mark


- Livin - 2006-07-04

this is when we'd enjoy a "remote desktop" type interface... so you could just build a thin client on the psp (or any other device).

ah... dreams Wink


- mcgeebc - 2006-07-07

i am new to xbmc and just discovered the http interface. i have been reading this thread, and would love to control my xbmc over wi-fi through a portable device, but alas i have no such device.

i've seen that people are using their psps and pocket pcs to do this. are there any other portable wi-fi (non-laptop) devices that work well? has anyone tried a blackberry? any way to get a nintendo-ds to work, or will we have to wait for the browser cartridge to hit the shelves to find out? are there any other preferably inexpensive devices exist that will allow me to control my xbmc wirelessly? what model of pocket pcs are people using?

sorry for all the questions, but i can't find this information anywhere else and hopefully the answers will be useful to others as well.


- nad - 2006-07-08

mcgeebc: you can use any device that is able to send commands across an http stream to your xbox.

to be as open as possible was one of the aims when i created the httpapi. i have uploaded to the file section of the xbmc page on sourceforge examples of how to write such code from .net, vb and excel. if you don't wish to use a microsoft oriented device then java or any other fairly generic language should work.

of course you will also need the network connection, whether wired, wifi, bluetooth or something else.


- nad - 2006-07-08

mfennel: could your flash interface display an image by pointing to it on the xbmc web server as you would do from html?

e.g. <img src="apic.gif" >

if so, you could just send httpapi commands to make sure the required images are where your code is expecting them.


- Drongo - 2006-07-09

nad, using the 3/7 build, the getpercentage command parameter seems to return an error when accessing the web server via ie. any ideas

edit - sorry nad but found out why. you have to set ie to force a new page on every command.


drongo






- Drongo - 2006-07-10

nad et all,

after some months of inactivity i'm back looking at my pda web interface. i noticed that you have changed the information returned in getcurrentlyplaying.

you have deleted paused and playing. any chance of now adding a playstatus which returns either playing/paused/stopped.

next i think i can shed some light on recent discussions about downloading and displaying thumbnails in your webbrowser. you now return the thumb parameter using a 'q' drive, which presumably is equivalent to e:/apps/xbmc. i think there are 2 problems here. firstly the path string you return has back slashes, whereas they really should be forward slashes when used in html images src's. secondly i'm sure i concluded sometime ago that the web server will only use paths that stem from its root folder; hence q:\userdata\thumbnails\music\8fd0c46b.tbn cannot be accessed as its not a child of the web folder. is there a way around this? if i copy the thumbs to a child folder and change my js code they display ok.

final point. sometimes the thumb response is not prsent when the results of getcurrentlyplaying are displayed. for me it seemed to stop showing thumb path after i skipped to next song in playlist. any idea why this may be happening?

any thoughts?

drongo






- nad - 2006-07-10

hi drongo,

i hadn't noticed paused and playing had gone. unless i can find a reason not to, i'll put them back in the form you suggested.

internally, the file system uses back slashes as you would expect and when sending file commands through the httpapi backslashes are expected. i could add a toggle which would specify which type of slash to return. would that work for you?

the file path for the thumbs is not set by httpapi - it comes from the core code. to get what you are after you could use the filecopy command to copy a file from the thumb folder to a folder that the web server can access.

not sure about the missing thumb problem. the file you skip to definitely has a thumb?


- TeknoJuce - 2006-07-10

hello nad,

just wondering if you can tell the http-api to stop parsing for & and = after "&parameter=" because some file names can contain these characters and then will show up in the debug log as it gets the httpapi command but it wont play the file.
and yes even if you escape code the symbols it doesnt seem to play.

22:19:15 m: 39542784   debug: webs: accept request
22:19:15 m: 39542784   debug: xbmchttpshim: received command playfile&parameter=smb://compname/f/video/denis leary's merry f#&%$in' christmas.avi (none)
22:19:15 m: 39542784   debug: httpapi start command: playfile&parameter=smb://compname/f/video/denis leary's merry f#&%$in' christmas.avi  paras: playfile&parameter=smb://compname/f/video/denis leary's merry f#&%$in' christmas.avi
22:19:15 m: 39542784   debug: httpapi finished command: playfile&parameter=smb://compname/f/video/denis leary's merry f#&%$in' christmas.avi
22:24:36 m: 39264256   debug: webs: accept request
22:24:36 m: 39264256   debug: xbmchttpshim: received command playfile&parameter=smb://compname/f/video/denis leary's merry f#=%$in' christmas.avi (none)
22:24:36 m: 39264256   debug: httpapi start command: playfile&parameter=smb://compname/f/video/denis leary's merry f#=%$in' christmas.avi  paras: playfile&parameter=smb://compname/f/video/denis leary's merry f#=%$in' christmas.avi
22:24:36 m: 39264256   debug: httpapi finished command: playfile&parameter=smb://compname/f/video/denis leary's merry f#=%$in' christmas.avi

if i remove them the file plays fine. " & and = " that is...

also currently smb over http-api commands doesnt use the user/pass set in xbmc on freshboot so when you try to hit up the smb drive like you would in the gui it pops up the user/pass screen on the xbox else it will just deny player access to the file but if you goto that file and play it in xbmc gui, it will then allow access to those files over http-api, elupus said he maybe able to look at it over the next few days and would be trivial to add, but maybe you would like to check it out also.






- Drongo - 2006-07-11

nad, rather than use paused and playing please just add a playstatus parameter that can be playing/paused/stopped.

regarding the slashes i guess its just as easy for me to replace forward slashes with back slashes using js. i know that the path to the thumbs is set by the core code. its just that if its not a child of the web folder you can't access it. other devs - is it possible to move the thumbs to become a child of the web folder - in this way it makes it easier to display the thumbs in a web browser.

the file that i skip to has a thumb - its a track from the same album so all tracks in that album presumably have the same thumb.


- nad - 2006-07-11

drongo: i said i would do it in the form you suggested Smile
until the location of the thumbs is changed i would suggest just using filecopy.
does the xbmc gui show the thumb?

teknojuce: i'll have a look - i hadn't realised that files with = and & were valid.
i expect elupus will get the username/password one first.


- Drongo - 2006-07-11

nad, thanks for the quick response. the thumbs always appear in the gui, its just that the thumb response seems to go missing from the info returned from getcurrentlyplaying. really wierd.

drongo


- nad - 2006-07-11

teknojuce:

a filename with & in seems to work for me, e.g. "f:\weird&name.mp3":

Quote:http://xbox/xbmccmds/xbmchttp?command=playfile&parameter=f%3a%5cweird%26name%2emp3

however, a filename with = doesn't work because an internal test does not recognise it as a valid file name, e.g. "f:\weird=name.mp3":

Quote:http://xbox/xbmccmds/xbmchttp?command=playfile&parameter=f%3a%5cweird%3dname%2emp3

i'll fix the latter.






- nad - 2006-07-11

teknojuce:

within the file system = and _ seem to map on to the same character. you can test this by trying to create a file on your xbox which just differs by = and _, e.g weird_name.mp3 and weird=name.mp3. i think you will find you can't.

to play weird=name.mp3 you basically need to submit a request to play weird_name.mp3:

Quote:http://xbox/xbmccmds/xbmchttp?command=playfile&parameter=f%3a%5cfred%5fme%2emp3

drongo: thanks for the reply. final questions, is this behaviour consistent i.e. does the thumb always disappear after playing the first file in a play list. from your original post i don't believe this is the case - but i just want to check. also does it also occur if you don't skip forward but just let the play list naturally progress through itself?