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


- taoizt - 2007-11-20

This looks like an excellent interface!! Any updates on that yet? Is it also possible to used as remote software on a laptop to control XBMC?

Good good work!


- Nuka1195 - 2007-11-21

PHP Code:
import os
path 
"SMB://server/movies"
#path = "F:\\videos\\"
VIDEO_EXT ".m4v|.3gp|.nsv|.ts|.ty|.strm|.pls|.rm|.rmvb|.m3u|.ifo|.mov|.qt|.divx|.xvid|.bivx|.vob|.nrg|.img|.iso|.pva|.wmv|.asf|.asx|.ogm|.m2v|.avi|.bin|.dat|.mpg|.mpeg|.mp4|.mkv|.avc|.vp3|.svq3|.nuv|.viv|.dv|.fli|.flv|.rar|.001|.wpl|.zip|.vdr|.dvr-ms|.xsp"
print xbmc.executehttpapi"GetDirectory(%s,%s)" % ( pathVIDEO_EXT, ) ) 

Does the GetDirectory() command support samba? It works for the local path, but I can't get it to work for the samba share.

The share is available to XBMC, it works fine form all sections, it's a guest account so not an iisue there.

Thanks

Edit log output for failed response:

Quote:
09:01:08 M: 38182912 DEBUG: XBMCHTTPShim: Received command GetDirectory (SMB://server/movies;.m4v|.3gp|.nsv|.ts|.ty|.strm|.pls|.rm|.rmvb|.m3u|.ifo|.mov|.qt|.divx|.xvid|.bivx|.vob|.nrg|.img|.iso|.pva|.wmv|.asf|.asx|.ogm|.m2v|.avi|.bin|.dat|.mpg|.mpeg|.mp4|.mkv|.avc|.vp3|.svq3|.nuv|.viv|.dv|.fli|.flv|.rar|.001|.wpl|.zip|.vdr|.dvr-ms|.xsp)
09:01:08 M: 37842944 DEBUG: HttpApi Start command: GetDirectory paras: GetDirectory; SMB://server/movies;.m4v|.3gp|.nsv|.ts|.ty|.strm|.pls|.rm|.rmvb|.m3u|.ifo|.mov|.qt|.divx|.xvid|.bivx|.vob|.nrg|.img|.iso|.pva|.wmv|.asf|.asx|.ogm|.m2v|.avi|.bin|.dat|.mpg|.mpeg|.mp4|.mkv|.avc|.vp3|.svq3|.nuv|.viv|.dv|.fli|.flv|.rar|.001|.wpl|.zip|.vdr|.dvr-ms|.xsp
09:01:08 M: 37842944 DEBUG: HttpApi Finished command: getdirectory
09:01:08 M: 37855232 INFO: <li>Error



- nad - 2007-11-23

On the Xbox it should work but it currently won't on XBMC_PC.


- Nuka1195 - 2007-11-23

Ok, when i use a browse dialog to get the path, it works great, so the error is in my code above, sorry and thanks for a great feature (httpapi) Smile

Edit: so everyone else knows, it was the casing of the path. "SMB://" does not work, it needed to be "smb://". Should that be case insensitive?


- kwyshell - 2007-12-07

HTTAPI URL encoding issue:

I am trying to playback a file via HTTP API. If characters of filename are all ascii code 0-255, the api works without any problem.

If I send a file with Chinese or Japanese characters, the URL encoding function seems not to work properly.

I have tried to study the HTTPAPI control source and HTTPAPI VB6 source. I just find the URLEncode function doesn't work for UTF8 string.

After I encoding the url in UTF8 and BASE64 format, the HTTP API works.
XBMC http server can process UTF8 URL without any problem but you have to encode your URL in correct format.
Nod


- rickd - 2007-12-08

Neomorph am really interested in this capability and web interface. I am a heavy user of xbmc and girder and would love to try this out when it ready.

question will you be able to setup buttons on webpage to send an event to girder ie so we control a zones amp etc

nice work i note girder is heading to web based capability too


PPC - Client - KevMoore123 - 2007-12-08

Hi all,

Ive written a small Pocket PC Client that utilizes the XBMC HTTP- API. Its not meant to be competition for any existing clients, its just I wrote this to solve a particular problem I was having. Which was that I have an enormous library of music, and picking a particular song was a little cumbersome using the XBMC Interface.

So , I wrote a PPC client which allows me to search and build playlist. Its Beta at the mo, so there are a few features yet to be completed (Auto shutdown timer, Song on Demand (time delayed song playing), Video (although the XBMC interface is awesome for movies) and better UI design).

The app was written using c# on VS 2008 (Targeted at the CF .NET 2 framework).

You are more than welcome to have a look at the sourcecode, as its open to anyone who wants a play/interested in developing further.

Anyhoo, let me know if you want the source / client and id be happy to ship.

cheers

Kev


base64 encoding for images - KevMoore123 - 2007-12-08

Hi Guys,

are there any c# gurus help there who can help with getting a base64 image loaded into the Bitmap object via the HTTP - API? Im having a bit of hassle with the Compact Framework; Code:

public string LoadImageFromURL(string URL)
{
string xbmcCommand = string.Format(CommandConstants.FileDownload, URL.Replace("\\\\","\\"));
string fullCommand = string.Format("http://{0}{1}", _ipAddress, xbmcCommand);
MemoryStream s = XBMCHttpHandler.PostMessageWithRawResponse(fullCommand);

string tempFile = string.Format("{0}\\currentThumb.jpg", Path.GetTempPath());
using (FileStream f = new FileStream(tempFile, FileMode.Create))
{
f.Write(s.ToArray(), 0, (int)s.Length);
}

return tempFile;
}

try
{
string fileName = _helper.LoadImageFromURL(_currentlyPlaying.ThumbnailPath.Replace("\n", ""));
Bitmap bitImage = new Bitmap(fileName);
Thumbnail.Image = Image.FromHbitmap(bitImage.GetHbitmap());
}
catch (Exception e)
{
string message = e.Message.ToString();
}
finally
{
_attemptedThumbnailLoad = true;
}

The problem is that the Bitmap object wont load the filename (from the LoadIMageURL method). I try to encode it as a base64 string, but that didnt work eitherSad

Cheers

Kev


- nad - 2007-12-08

KevMoore: In case you haven't come across XBMCControl yet, have a look here: http://sourceforge.net/project/showfiles.php?group_id=87054&package_id=198866

kwyshell: I'm not too hot on how international character sets work in practice. Did you had to modify XBMCControl or was it XBMC itself? Can you tell me exactly how you got it to work (with code if possible) and I'll modify the code as necessary.


- KevMoore123 - 2007-12-08

Hi Nad,

this is my own project, not the source you have highlighted. Which of course you are welcome to if you want to play with it.

cheers

Kev


- nad - 2007-12-08

Kev: My point was that you may want to borrow the code from XBMCControl rather than reinvent everything. This includes the base64 image request you made today, though the code is vb.net not c#.


- KevMoore123 - 2007-12-08

Sorry Nad, Mis-read your comment !

Ive managed to solve it now Wink. Initialising the PictureBox with a new Bitmap(stream) seemed to do the trick.

I'll have a butchers at your app now.

Thanks a bunch anyway,

cheers

Kev


- KevMoore123 - 2007-12-08

Loving the app Nad. I havent got as far as doing Movie compatibility yet, as the sole aim for my app was to be able to play music without having the TV on.

Are you still developing your app? Ive done VB.NET before, so am happy to help when/where I can.

Similiarly, my code will be on sourceforge pretty soon so feel free to download it and play with it. Translation between c# and VB.NET on the CF are pretty straight forward.

I will post my source link here once the project is approved.

Cheers

Kev


- nad - 2007-12-08

Kev: If you go back to the start of this thread (50 pages!) you will find that "play music without having the TV on" was my aim as well. It is why I produced the HttpApi as well as XBMCControl. I just kept tinkering with both to where it is today. I was planning on making 1.91 the last version for a while. I can't think of much more functionality that I want. However, I still wish it looked better. When I started XBMCControl I was hoping someone with some artistic capabilities would pick it up and beautify it.

While my original aim was to have the app running on my PPC (which it does); I have found that the limited battery life of my PPC means that most of the time I am running the app on a laptop. So in v2 I may give up the ability to run the code on the PPC. This would allow me to come up with a nicer user interface though I am sure it still will look pretty awful.

I have just moved to VS2008, so whenever I do v2.0 it will use that project format.


- KevMoore123 - 2007-12-09

NAD: I absolutely agree, the battery life on the PDA is not great. Sorry for not reading 50 pages ago, im just a little impatient Smile. Im new to the XBMC and am only just discovering the power that the HTTP-API can do.

Upmost respect for the API, im from a c++ background myself but was unfortunate enough to be mostly coding MFC Sad. Since the launch of c# ive moved over to that arena, and to be honest ive never looked back since.

Whilst PDA's are great for portable low footprint apps, the battery life does let them down. Although I am fortunate enough to have PC to hand in the front room which can do a better job, I still like the idea of a PDA app on the coffee table that I can just pick up and mess with (Playlist etc).

I used to be an ITunes man, but soon realised that letting people (in a social situ) onto your machine to "Browse" music is a bad idea Wink

I Scrapped Itunes and converted all my M4p files to Mp3, and used TagScanner 5 to sort my library out. XBMC and its SQLLite DB is awesome, and being able to query that makes my life a lot easier.

Ive even had my Nintendo DS (Via Opera) browsing the music DB via a small Ajax browser I created, but found that Opera just didnt cut the mustard when it came to client based scripting.

Anyhoo, its good to know that there is someone out there with the technical ability to solve a problem using CF, Ajax. and even more important, someone who has created such an awesome API as HTTP-API.

Good work.

Cheers

Kev