Simplify video killing as it does not work

This commit is contained in:
Martin Müller 2017-07-14 15:04:21 +02:00
parent 3e15a967f8
commit 804891e1d0

View File

@ -41,17 +41,12 @@ def index(sound=None, text=None, video=None):
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()
audioproc = subprocess.Popen(["omxplayer", url.split("\n")[1]]) subprocess.Popen(["omxplayer", url.split("\n")[1]])
videoproc = subprocess.Popen(["omxplayer", "-b", url.split("\n")[0]]) subprocess.Popen(["omxplayer", "-b", url.split("\n")[0]])
processlist.append(audioproc)
processlist.append(videoproc)
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"]:
for process in processlist: subprocess.Popen(["pkill", "-f", "omxplayer"])
process.terminate()
processlist.remove(process)
return render_template("index.html", sounds=sounds) return render_template("index.html", sounds=sounds)