forked from server/soundboard
Switch from spaces to tabs for indentation
This commit is contained in:
parent
0026d9cce3
commit
600a1875f6
@ -17,44 +17,44 @@ processlist = []
|
|||||||
@app.route("/say/", methods=["POST"])
|
@app.route("/say/", methods=["POST"])
|
||||||
@app.route("/say/<text>")
|
@app.route("/say/<text>")
|
||||||
def index(sound=None, text=None, video=None):
|
def index(sound=None, text=None, video=None):
|
||||||
sounds = [os.fsencode(file).decode() for file in os.listdir(config.path)]
|
sounds = [os.fsencode(file).decode() for file in os.listdir(config.path)]
|
||||||
sounds = sorted(sounds)
|
sounds = sorted(sounds)
|
||||||
|
|
||||||
if sound is not None and sound in 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)
|
subprocess.Popen(["omxplayer", os.path.join(config.path, sound).encode("utf-8")], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
|
||||||
if text is None:
|
if text is None:
|
||||||
text = request.form.get("text")
|
text = request.form.get("text")
|
||||||
|
|
||||||
if text is not None:
|
if text is not None:
|
||||||
voice = request.form.get("voice", default="")
|
voice = request.form.get("voice", default="")
|
||||||
voice = voice if voice.strip() != "" else "DE"
|
voice = voice if voice.strip() != "" else "DE"
|
||||||
speed = request.form.get("speed", default="")
|
speed = request.form.get("speed", default="")
|
||||||
speed = speed if speed.strip() != "" else "160"
|
speed = speed if speed.strip() != "" else "160"
|
||||||
pitch = request.form.get("pitch", default="")
|
pitch = request.form.get("pitch", default="")
|
||||||
pitch = pitch if pitch.strip() != "" else "50"
|
pitch = pitch if pitch.strip() != "" else "50"
|
||||||
|
|
||||||
subprocess.Popen(["espeak", "-v", voice, "-s", speed, "-p", pitch, text], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
subprocess.Popen(["espeak", "-v", voice, "-s", speed, "-p", pitch, text], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
return redirect("/")
|
return redirect("/")
|
||||||
|
|
||||||
video = request.args.get("video")
|
video = request.args.get("video")
|
||||||
|
|
||||||
if video is not None:
|
if video is not None:
|
||||||
url = subprocess.check_output(["youtube-dl", "-g", "-f", "mp4", video]).decode()
|
url = subprocess.check_output(["youtube-dl", "-g", "-f", "mp4", video]).decode()
|
||||||
subprocess.Popen(["omxplayer", url.split("\n")[1]])
|
subprocess.Popen(["omxplayer", url.split("\n")[1]])
|
||||||
subprocess.Popen(["omxplayer", "-b", url.split("\n")[0]])
|
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"]:
|
if killvideo is not None and killvideo in ["1", "true", "yes"]:
|
||||||
subprocess.Popen(["pkill", "-f", "omxplayer"])
|
subprocess.Popen(["pkill", "-f", "omxplayer"])
|
||||||
|
|
||||||
if request.path == "/edit":
|
if request.path == "/edit":
|
||||||
edit = True
|
edit = True
|
||||||
else:
|
else:
|
||||||
edit = False
|
edit = False
|
||||||
|
|
||||||
return render_template("index.html", sounds=sounds, edit=edit)
|
return render_template("index.html", sounds=sounds, edit=edit)
|
||||||
|
|
||||||
@app.route("/edit/<sound>", methods=["GET", "POST"])
|
@app.route("/edit/<sound>", methods=["GET", "POST"])
|
||||||
def edit(sound):
|
def edit(sound):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user