exit xbmc from script - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111) +---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52) +---- Thread: exit xbmc from script (/showthread.php?tid=34635) |
exit xbmc from script - bugme - 2008-07-07 Hi, I have a small question. Googled for ages, no luck. Explenation (skip this if you're in a hurry): I have an older P3 800MHz running XBMC through Xubuntu. I can watch video just fine. I also use ZSNES, which runs fine. I created this extremely complicated script to run ZSNES from XBMC: Code: import os Question: Can I simply exit xbmc from a python script started from xbmc, and restart it when the started app (zsnes) is finished? Or does someone have another suggestion for getting this behaviour to work? Thanks - kraqh3d - 2008-07-07 there is a builtin command that can be executed to shutdown xbmc, but i'm not sure how python works in xbmc linux. i'm assuming the internal interpretter will be used which leads me to believe that nothing after that line will run. so i think you need to call an external script that will be run by an external interpretter before closing xbmc. then that script can launch zsnes and then restart xbmc on close. ** edit ** moved to the linux forum. hopefully someone will have more info there. - rodalpho - 2008-07-07 Something like this should work. Python script: Code: import os runzsnes.sh: Code: #!/bin/bash - bugme - 2008-07-07 Thanks a bunch, rodalpho! Here's how I used it. /home/xbmc/.xbmc/scripts/My Scripts/zsnes.py: /home/xbmc/xbmc/zsnes.sh: Code: #!/bin/bash It works! Only thing I don't get is why I cannot use `logname` in stead of actually typing in my username. - bugme - 2008-07-07 Not very interesting, but since I'm too blind to find the EDIT button, this was what the other line was supposed to say: /home/xbmc/.xbmc/scripts/My Scripts/zsnes.py: Code: import os - kraqh3d - 2008-07-07 i dont know but `whoami` seems to work just fine. - bugme - 2008-07-07 One more thing, might be interesting for people trying to do the same thing. I don know why, but from python I can just boot zsnes. But if I use this trick to kill xbmc first, the sound is gone. I googled for sound problems, and somehow this fixes it: Code: # Start ZSNES - rodalpho - 2008-07-07 Happy to help! - bugme - 2008-07-07 Um, sorry, no it does not. It fixes the sound if you run zsnes from a command prompt, but not from within xbmc. I confused. And I wouldn't have made such a mess if I knew how to edit my own posts. Sorry. - bugme - 2008-07-07 kraqh3d Wrote:i dont know but `whoami` seems to work just fine.I just tried it, and you are right! `logname` also works, so I hate to admit that it was probably a typo on my end heheh.. whoami.. didn't know that one - bugme - 2008-07-08 Ok I sorted it out. Here's a summary of strange behaviour: $ zsnes (from command line) Works without sound $ zsnes -ad sdl (from command line) Works $ xbmc (from command line) Works zsnes (from script.sh in xbmc) Works without sound zsnes -ad sdl (from script.sh called by xbmc) Works without sound xbmc (from script.sh called by (now killed) xbmc) Works without sound (??) with script.sh being called from the above mentioned python script. Anyone got a clue why this happens? - KeithB - 2008-07-08 Could it be related to something in the shell you use at the commandline compared to the shell used by sh when running your script? - Gamester17 - 2008-07-08 Would it not be simpler just to convert emuLauncher script into a plugin for XBMC? http://forum.xbmc.org/showthread.php?tid=32186 http://forum.xbmc.org/showthread.php?tid=30659 http://forum.xbmc.org/showthread.php?tid=33970 http://forum.xbmc.org/showthread.php?tid=32150 Nuka1196 and spiff from Team-XBMC are working on a such plugin (and the changes need in XBMC to make it happen), I do not however know the progress they made on this. - bugme - 2008-07-08 I use linux for quite some time now but it can still surprise me. So the correct answer would be: Not that I know of. This is how I directly enter it in the xfce4-terminal virtual console. Or when I create a launcher on my desktop. Or when I run it using alt+f2 dialog. So I was thinking, could this be related to something xbmc changes for sh that's not changed in a normal commandline? - bugme - 2008-07-08 Hey Gamester17 I didn't read your reply yet, but it sounds like a splendid idea. I will have to read through these topics but if it has xbmc running in the background I will have the same problem as why I wanted to script-exit xbmc in the first place. (This old computer cannot handle too much at the same time.) |