forked from server/soundboard
Move path to external file
This commit is contained in:
parent
3391c7e076
commit
838881a1b3
1
config.py.example
Normal file
1
config.py.example
Normal file
@ -0,0 +1 @@
|
|||||||
|
path = "/home/pi/sounds"
|
||||||
@ -5,7 +5,7 @@ import subprocess
|
|||||||
|
|
||||||
from flask import Flask, render_template, request, redirect, url_for
|
from flask import Flask, render_template, request, redirect, url_for
|
||||||
|
|
||||||
path = "/home/pi/sounds"
|
import config
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
app.jinja_env.trim_blocks = True
|
app.jinja_env.trim_blocks = True
|
||||||
@ -16,7 +16,7 @@ app.jinja_env.lstrip_blocks = True
|
|||||||
@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 = sorted(os.listdir(path))
|
sounds = sorted(os.listdir(config.path))
|
||||||
|
|
||||||
if sound is not None and sound in sounds:
|
if sound is not None and sound in sounds:
|
||||||
subprocess.Popen(["omxplayer", os.path.join(path, sound)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
subprocess.Popen(["omxplayer", os.path.join(path, sound)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user