Open Program from Python script
-
Hi guys, hoping someone can help. I'm probably going about this all wrong but I'm trying to create a button on my TV remote that will open Kodi with one click. I've been trying to do this by modifying this script: https://github.com/dillbyrne/es-cec-input.
I've edited, and added to, the block from lines 173 & 174, so it now reads:
elif "exit" in line: device.emit_click(keylist[1]) elif "green" in line: Kodi = subprocess.Popen("/home/pi/RetroPie/roms/ports/Kodi.sh")
but it just won't work while I'm in EmulationStation. Like I said, I'm probably way off the mark here, but if anyone has any ideas, it'd be appreciated.
-
Kodi probably doesn't like that Emulationstation is started and has control of the screen - try exiting Emulationstation first, then start Kodi.
-
@mitu What happens when you load a rom from the ES menu? It is suspended and then resumed somehow (as it loads back up in the same place you left it)?
-
The 'suspend & resume' is triggered internally by Emulationstation, when it starts the emulator/game, it's not accessible externally.
-
@mitu Ah, that scuppers those plans then. I think I'll give this up as a failed experiment. I did manage to get Kodi to launch from my green button by importing psutil and check_output and changing the code to
espid = int(check_output(["pidof","-s","emulationstation"])) es = psutil.Process(espid) es.suspend() Kodi = subprocess.Popen("/home/pi/RetroPie/roms/ports/Kodi.sh") Kodi.wait es.resume()
But then the script would no longer start from my crontab on boot so not really usable.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.