Last active
May 20, 2016 23:36
-
-
Save sehugg/6098ccfb5a0bee897f41147ceee7016f to your computer and use it in GitHub Desktop.
Random MAME launcher script for RetroPie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import random, subprocess, time, sys, os, os.path | |
roms = os.listdir(os.path.expanduser('~/RetroPie/roms/mame-mame4all/')) | |
roms = [x.split('.')[0] for x in roms] | |
random.shuffle(roms) | |
MAME4ALL = '/opt/retropie/emulators/mame4all/mame' | |
for rom in roms: | |
print(rom) | |
p = subprocess.Popen([MAME4ALL, rom]) | |
time.sleep(2) | |
code = p.poll() | |
if code is None: | |
time.sleep(120) | |
try: | |
p.kill() | |
p.wait() | |
except KeyboardInterrupt: | |
raise | |
except: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment