Help with scripting within XBMC?
#1
Hello,

I was thinking of trying my hand at writing a script or two for XBMC. I have read many threads on here explaining the ins and outs of writing scripts using python, but I have not seen is an explanation of how to test something one has written inside of XBMC. So say I write some simple code, I can test it within the python command window and see that it does what I tell it to. How do I take this code and test it within XBMC? Is there an XBMC test bed or stripped down version of XBMC to use? Could one of the Devs, possibly answer this probably amazingly stupid question?
Is there something else I should read to maybe help in this area?

Thanks guys,
Mark
Reply
#2
From what I can understand there is no testbed, you have to install the add-on and run in xbmc. On the bright side everthing you print and all errors ends up on the log.
EDIT: and it is possible to attach a remote debug session from eclipse.

In order to maximize what you can test outside xbmc make this construction:
default.py - no logic, only gets things started
/resources/lib/gui.py - handle the gui and the communication with xbmc
/resources/lib/core.py - handle the "business logic"


In the end of core.py you can do this:

if __name__ == '__main__':
#These rows will be executed only if called from command line
#personally I put a small menu here to call the functions in test mode.

If you want to make it more advance you can

try
import xbmc
exception
xbmc = null

To run the same script with and without xbmc
Reply
#3
I don't think anyone has gone to the trouble of implementing test automation for XBMC scripts but it is not to hard...

Expose a debug shell in your script that you can telnet into:

http://code.google.com/p/mythbox/source/...x/shell.py

Login to the debug shell and run whatever tests you like via the interactive python interpreter. If you have unit tests, you can execute them directly. Better yet, you can use python's built in Telnet class to automate the whole thing (log into the shell from outside of xbmc and execute your tests).
MythBox for XBMC - http://mythbox.googlecode.com
Reply

Logout Mark Read Team Forum Stats Members Help
Help with scripting within XBMC?0