Possible to write a server via the python api?
#1
i'm wanting to add a socket service into xbmc and am wondering if i can do so via the python interface. i will want it to be running in the background at all times listening on a socket and answering requests. preferably i would not want the user to have to kick it off. is this possible, if so are there any examples out there for me to look at?

thanks,

tim
Reply
#2
hi
you can use socket library. it works on xbox and you sohould find many example all over the internet... ask your friend, google, it should find you some answers
Reply
#3
i realize there is the socket support i need. what i'm asking is if there is a way to have the script 'auto-run' in the background without user intervention and therefor to act as a server. in other words i wish to design a service that runs in the background and has no user interaction from the xbox console.
Reply
#4
yes you can. take a look at the script collection at http://dwl.xboxmediacenter.de. the yac2 script runs completely in the background.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#5
(kraqh3d @ feb. 07 2005,22:28 Wrote:yes you can. take a look at the script collection at http://dwl.xboxmediacenter.de. the yac2 script runs completely in the background.
thanks, a perfect example!

one more question: according to the author this script has to be renamed to autoexec.py so that it runs on startup. obviously only 1 script can be named that. is there support for autoexec'ing more than 1 script? i assume you could write an autoexec.py that kicks off whatever other scripts you want (this will be my first python project, so i'm clueless how to do that myself). it would probably be easier if xbmc had an 'autoexec' or 'startup' sub-directory within the scripts.
Reply
#6
only autoexec.py is supported. i think you could have autoexec.py run additional scripts then, but im not sure.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
Reply
#7
autoexec.py is made to launch when your xbmc is loading.
you can try to add som lines :
xbmc.executescript('script.py')
xbmc.executescript('script2.py')
xbmc.executescript('script3.py')
...
but this will only run scripts one after the others...

maybe could it be possible using threading, to run several scripts at the same time (might be tricky for a beginner i think...)
Reply
#8
i suppse you could replace 'autoexec.py' with a script that did an 'xbmc.executescript' for all items within a 'startup' directory or something. the comment in the file states you shouldn't run more than one script at a time that requests user input, which makes sense. i don't see any reason why you couldn't add as many 'server' type scripts as you want however.

i'm well on my way to having my own service running. i hadn't gotten my feet wet in python or the xbmc python bindings until now.

thanks for the help!
Reply

Logout Mark Read Team Forum Stats Members Help
Possible to write a server via the python api?0