RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    Open Program from Python script

    Scheduled Pinned Locked Moved Help and Support
    kodipythonpopenscriptgithub
    5 Posts 2 Posters 655 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      thejason40
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • mituM
        mitu Global Moderator
        last edited by mitu

        Kodi probably doesn't like that Emulationstation is started and has control of the screen - try exiting Emulationstation first, then start Kodi.

        T 1 Reply Last reply Reply Quote 0
        • T
          thejason40 @mitu
          last edited by

          @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)?

          mituM 1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator @thejason40
            last edited by

            The 'suspend & resume' is triggered internally by Emulationstation, when it starts the emulator/game, it's not accessible externally.

            T 1 Reply Last reply Reply Quote 0
            • T
              thejason40 @mitu
              last edited by thejason40

              @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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post

              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.