exit xbmc from script
#16
Lightbulb 
bugme Wrote: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.)
An option to exit XBMC on launch or leave running in the background could probably be added (that the user could choose to enable/disable from within the GUI, or be added to the to the python plugin by the author if the author feels that needs to be hardcoded), but you would have to ask Nuka1195/spiff to be 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
#17
bugme Wrote: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?

What shell are you running from the console window? (echo $SHELL)
Reply
#18
The shell is /bin/bash for the virtual console. I guess that makes it the same for autostarted apps (such as XBMC).

There are no errors though (outputted by the shell from scripts). Both xbmc and zsnes -ad sdl work fine from the shell, but not when chained (scriptwise). It's like xbmc does some stuff that makes zsnes sound impossible (does it remove sdl support for it's own good?), and zsnes in turn does stuff that makes xbmc sound fail.

I am about to go on a road trip any day now, spontaneously. So if I stop responding, I'll be back a week (or two) later.
Reply
#19
What about renice to make xbmc almost sleep in the background, or even use sleep?
Also why not use 'pidof' instead of ps aux etc?

Thanks for showing me that os.system('command') works, have been looking for that one a week or so now. =)
Reply
#20
After encountering a similar scenario on my desktop: Playing a movie using totem and browsing YouTube from firefox, the YouTube video had no sound.

I did some digging around, and it seems that ALSA has issues with multiple parallel sound sources.

I think it's one of the reasons Ubuntu is trying to push the PulseAudio subsystem (which does support multiple sound sources).

So, try to switch your Audio Mixer from ALSA to PulseAudio.

Let me know if it works...
Reply
#21
Thanks for the response. Both sound good. But since I am targetting a slow computer, I'll avoid parallel capabilities for now. It's weird anyway because the script closes xbmc before opening zsnes, theoretically no parallel programs.

loosec Wrote:What about renice to make xbmc almost sleep in the background, or even use sleep?
This sounds interesting, can you elaborate?

Here's new situation:
xbmc script closes xbmc and launches zsnes or gngeo: no sound
When autostarting xbmc after exit zsnes/gngeo: no sound

Al three apps do have sound when started on their own (no script)
Reply
#22
@loosec, no need to elaborate on that. I got it, good idea. I will try that after I get sound to work without pulse audio (other stuff I need also only supports alsa/oss)
Reply
#23
I got the exit script working with the previously mentioned hints, but I cannot take control of xbmc when it comes back. I want to reload the script so I don't have to navigate back.

Is there a way to do the same in python(, since with python I can import xbmc and run the script again)?
Reply
#24
use autoexec.py
Reply
#25
I now have something like this, launched from a script in the script folder/name/default.py:

start.sh
Code:
pidof xbmc.bin|xargs kill # Shutdown
sleep 1
# Launch zsnes
zsnes
# Done? Restart XBMC
xbmc
# code for reloading script in xbmc
sleep 1
python return.py
return.py
Code:
import os, xbmc
HOMEDIR = os.getcwd().replace(";","")+"/"    # script.dirname
xbmc.executescript(HOMEDIR + 'default.py')

What works:
xbmc shutdown
zsnes boot
xbmc restart on zsnes exit

What doesn't:
sound
restarting the script

with the latter being the most important (at the moment).
Any tips?
Reply
#26
Didn't read your reply yet spiff, I'll look into it!
Reply
#27
spiff Wrote:use autoexec.py

Does it work for linux xbmc also?

I've got
/home/sander/.xbmc/scripts/autoexec.py:
Code:
import xbmc
xbmc.executescript('/home/sander/.xbmc/scripts/Arcade Browser/default.py')

Nothing happens when (re)starting xbmc. The script/path is right, I can execute it from terminal. (escaping the space doesn't matter).
Reply
#28
it should though i have never tried it
Reply
#29
Well it doesn't and I found out why:

autoexec.py is only searched for in the shared usr folder, which is under normal conditions read-only to all non-superusers (aka xbmc). So xbmc autoloads this file:
/usr/share/xbmc/scripts/autoexec.py

When my script is altering autoexec.py on the fly it wants to store it in xbmc's home folder because the usr folder is read only:
/home/sander/.xbmc/scripts/autoexec.py
Reply
#30
All works fine if you chmod a+rw both
/usr/share/xbmc/scripts
and
/usr/share/xbmc/scripts/autoexec.py

But on one of my target computers I don't have root access, and that's what /home is for (files that need to be changed by user), that that's why I think this should be concidered a bug.

What do you guys think?
Reply

Logout Mark Read Team Forum Stats Members Help
exit xbmc from script0