diff --git a/config.py.example b/config.py.example new file mode 100644 index 0000000..841b7df --- /dev/null +++ b/config.py.example @@ -0,0 +1 @@ +path = "/home/pi/sounds" diff --git a/soundboard.py b/soundboard.py index a501310..3299973 100644 --- a/soundboard.py +++ b/soundboard.py @@ -5,7 +5,7 @@ import subprocess from flask import Flask, render_template, request, redirect, url_for -path = "/home/pi/sounds" +import config app = Flask(__name__) app.jinja_env.trim_blocks = True @@ -16,7 +16,7 @@ app.jinja_env.lstrip_blocks = True @app.route("/say/", methods=["POST"]) @app.route("/say/") def index(sound=None, text=None, video=None): - sounds = sorted(os.listdir(path)) + sounds = sorted(os.listdir(config.path)) if sound is not None and sound in sounds: subprocess.Popen(["omxplayer", os.path.join(path, sound)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)