diff --git a/libstormgames.py b/libstormgames.py index fc6d4ab..fc4359c 100755 --- a/libstormgames.py +++ b/libstormgames.py @@ -11,6 +11,7 @@ from xdg import BaseDirectory import pygame import pyperclip import random +import re import requests import speechd import subprocess @@ -73,6 +74,13 @@ def initialize_gui(gameTitle): time.sleep(soundData['game-intro'].get_length()) return soundData +def play_random(soundName): +key = [] +for i in sounds.keys(): + if re.match("^" + soundName + ".*", i): + key.append(i) +psounds[random.choice(key)].play() + def instructions(): # Read in the instructions file try: