From 600a1875f6f60d2c1872f44932485a77ecfc066f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=BCller?= Date: Tue, 18 Jul 2017 21:11:04 +0200 Subject: [PATCH] Switch from spaces to tabs for indentation --- soundboard.py | 56 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/soundboard.py b/soundboard.py index aa8704a..efa7f7f 100644 --- a/soundboard.py +++ b/soundboard.py @@ -17,44 +17,44 @@ processlist = [] @app.route("/say/", methods=["POST"]) @app.route("/say/") def index(sound=None, text=None, video=None): - sounds = [os.fsencode(file).decode() for file in os.listdir(config.path)] - sounds = sorted(sounds) + sounds = [os.fsencode(file).decode() for file in os.listdir(config.path)] + sounds = sorted(sounds) - if sound is not None and sound in sounds: - subprocess.Popen(["omxplayer", os.path.join(config.path, sound).encode("utf-8")], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + if sound is not None and sound in sounds: + subprocess.Popen(["omxplayer", os.path.join(config.path, sound).encode("utf-8")], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - if text is None: - text = request.form.get("text") + if text is None: + text = request.form.get("text") - if text is not None: - voice = request.form.get("voice", default="") - voice = voice if voice.strip() != "" else "DE" - speed = request.form.get("speed", default="") - speed = speed if speed.strip() != "" else "160" - pitch = request.form.get("pitch", default="") - pitch = pitch if pitch.strip() != "" else "50" + if text is not None: + voice = request.form.get("voice", default="") + voice = voice if voice.strip() != "" else "DE" + speed = request.form.get("speed", default="") + speed = speed if speed.strip() != "" else "160" + pitch = request.form.get("pitch", default="") + pitch = pitch if pitch.strip() != "" else "50" - subprocess.Popen(["espeak", "-v", voice, "-s", speed, "-p", pitch, text], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - return redirect("/") + subprocess.Popen(["espeak", "-v", voice, "-s", speed, "-p", pitch, text], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + return redirect("/") - video = request.args.get("video") + video = request.args.get("video") - if video is not None: - url = subprocess.check_output(["youtube-dl", "-g", "-f", "mp4", video]).decode() - subprocess.Popen(["omxplayer", url.split("\n")[1]]) - subprocess.Popen(["omxplayer", "-b", url.split("\n")[0]]) + if video is not None: + url = subprocess.check_output(["youtube-dl", "-g", "-f", "mp4", video]).decode() + subprocess.Popen(["omxplayer", url.split("\n")[1]]) + subprocess.Popen(["omxplayer", "-b", url.split("\n")[0]]) - killvideo = request.args.get("killvideo") + killvideo = request.args.get("killvideo") - if killvideo is not None and killvideo in ["1", "true", "yes"]: - subprocess.Popen(["pkill", "-f", "omxplayer"]) + if killvideo is not None and killvideo in ["1", "true", "yes"]: + subprocess.Popen(["pkill", "-f", "omxplayer"]) - if request.path == "/edit": - edit = True - else: - edit = False + if request.path == "/edit": + edit = True + else: + edit = False - return render_template("index.html", sounds=sounds, edit=edit) + return render_template("index.html", sounds=sounds, edit=edit) @app.route("/edit/", methods=["GET", "POST"]) def edit(sound):