Open Brandoskey opened 6 years ago
This is a bad method!
Use python handler import subprocess output = subprocess.check_output(['./multi_switch.sh', '--es-pid'])
to get PID from ES binary if value>0 then EmulationStation is running and now use os.system("./multi_switch.sh --es-poweroff") to prober close system... and save metadata in every usecase If value 0 is returned use regular shutdown os.system("sudo shutdown -h now")
multi_switch.sh can be used from my github here https://github.com/crcerror/ES-generic-shutdown
This is the swiss knife for ES shutdowns. Use as you want, but give credits to the original author!
I don't doubt you're correct but could you elaborate on why this is a bad method?
I'm all for a better method of course!
Because it breaks saving metadata if you are using it within an emulator. The correct way is: Close all emulators then you should wait until PID for ES is finished before initiating shutdown/reboot because filesystem gets locked during shutdown process >> it's very likely you loose metadata. So it may work in most cases but is for away from being generic ;)
That makes sense
I've modified your script in retropie so emulationstation is gracefully terminated and metadata is saved
functions that handle button events
def when_pressed(): led.blink(.2,.2) os.system("sudo killall emulationstation && sleep 5s && sudo shutdown -h now") def when_released(): led.on() def reboot(): os.system("sudo killall emulationstation && sleep 5s && sudo reboot")
This was at the suggestion of an amazon user named Crysknife007
There may be a better way to accomplish this but this method definitely works. Obviously something more universal that does the same if you're using attractmode or some other front end would also be ideal.