Android Force Shutdown/Exit by python
#1
Hello all,

I would like to copy some setting files when XBMC is running.
These files will automaticly be rewritten by XBMC so i wonder if there is a way to force exit/terminate?
This way XBMC will read the setting files on the next startup and will use them.
My questing is can we terminate XBMC (force exit) from python?
I hope there is a way, making a one time crash to force exit would also help me a lot :S
The goal is to change the gui settings wich can not be rewritten when XBMC is running.
The files are copied and looking good when XMBC is running but when i close XBMC the xml files are automaticly rewritten, i would like to avoid that.

I am running Gotham-Alpha-9 on Android.
I tried to load an .sh from python script but without root that does not work.
i am working with an autoexec.py in userdata path.

Code:
import xbmc, xbmcgui, os,  sys
import xbmcvfs
#import android

file = xbmc.translatePath( 'special://home/userdata/guisettings.xml' )
fileb = xbmc.translatePath( 'special://home/userdata/guisettings.xml.bak' )
def delete_file(file):
    if xbmcvfs.exists(fileb):
        xbmcvfs.delete(file)
        xbmc.sleep( 5000 )
        xbmcvfs.copy(os.path.join( xbmc.translatePath( 'special://home/userdata/' ), 'guisettings.xml.bak'), os.path.join( xbmc.translatePath( 'special://home/userdata/' ), 'guisettings.xml'))
        xbmc.sleep( 5000 )
        xbmcvfs.delete(fileb)
  
delete_file(file)
xbmc.sleep( 10000 )

// here XBMC needs to exit for a restart.....

Any suggestions?
Thanks
Reply
#2
I've got no idea if this will work on Android, but I've think you can restart xbmc from python by doing:
Code:
xbmc.executebuiltin('XBMC.RestartApp()')
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#3
Although I suppose doing this will just cause xbmc to rewrite your settings...
BBC Live Football Scores: Football scores notifications service.
script.squeezeinfo: shows what's playing on your Logitech Media Server
Reply
#4
yes i tried that also, it results in the same rewrite isues.

Anyone know how to make gotham-Alpha-9 crash?
if i can do this with an unresolved bug i am also verry happy Big Grin
Reply
#5
Thanks. Big Grin
Reply

Logout Mark Read Team Forum Stats Members Help
Force Shutdown/Exit by python0