Kodi Community Forum
Win Call CGI in Webinterface - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Win Call CGI in Webinterface (/showthread.php?tid=136897)



Call CGI in Webinterface - hojel - 2012-07-25

Is it possible to call CGI script in Webinterface addon?
I plan to reuse Python script in Windows environment, but hard to find related info, such like how to specifying Python path.



RE: Call CGI in Webinterface - Bstrdsmkr - 2012-07-26

Can you give an example of what you're trying to do?

XBMC contains a full python environment and just adds the XBMC modules to it. Anything you can do in a regular Python environment can be done in XBMC. The only changes are in how you present things to the user


RE: Call CGI in Webinterface - hojel - 2012-07-26

Here is the plan:

Name of the first addon is 'webinterface.test1'. It has web interface to show some information collected from other website.
But XMLHttpRequest() method is bounded to local, so I will use python script, either cgi style resided in the same directory or another addon, like script.meta.test2.
It will return xml(or json).

I tried to call cgi script in python in web page, but it wasn't recognized as cgi. I tried .py and .cgi extensions but both didn't work.


RE: Call CGI in Webinterface - Bstrdsmkr - 2012-07-26

Ahhh ok, so you want to host and serve a cgi script from within xbmc. I thought you wanted to execute a cgi script which is hosted by another, standalone, server.

It can still be done, but you would need to package up a whole web server. There is almost certainly a better way. Depending on what you're trying to do, the most straight forward solution is probably to implement it in Javascript which is executed on the client side, whereas cgi is executed on the server side (which wouldn't require you to implement a python webserver)


RE: Call CGI in Webinterface - hojel - 2012-07-27

Thanks Bstrdsmkr. The python code is a part of python webserver already. I wonder if there is a way I can handle within xbmc environment.


RE: Call CGI in Webinterface - Bstrdsmkr - 2012-07-27

If it's part of python 2.7 standard packages, it should be available and work just the same within xbmc