Merge branch 'random' into 'master'

fix errors

See merge request mmueller/soundboard!6
This commit is contained in:
Klug 2018-01-16 09:57:02 +00:00
commit d671cd487d

View File

@ -153,5 +153,5 @@ def sounds(name):
@app.route("/random") @app.route("/random")
def play_random(): def play_random():
sounds = [os.fsencode(file).decode() for file in os.listdir(config.path)] sounds = [os.fsencode(file).decode() for file in os.listdir(config.path)]
random_sound = random.sample(sounds, 1) random_sound = random.sample(sounds, 1)[0]
subprocess.Popen(["omxplayer", os.path.join(config.path, random_sound.encode("utf-8")], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) subprocess.Popen(["omxplayer", os.path.join(config.path, random_sound).encode("utf-8")], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)