mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-16 14:52:11 +00:00
fix
This commit is contained in:
@@ -5,6 +5,8 @@ from flask import Flask, jsonify, request
|
|||||||
from waitress import serve
|
from waitress import serve
|
||||||
|
|
||||||
|
|
||||||
|
HOST_ADDRESS = "192.168.1.191"
|
||||||
|
PORT_ADDRESS = 5000
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@app.route("/mp3", methods=["GET"])
|
@app.route("/mp3", methods=["GET"])
|
||||||
@@ -14,7 +16,7 @@ def get_music_list():
|
|||||||
:return: A JSON response containing a key "music_file_list" with the value of the variable
|
:return: A JSON response containing a key "music_file_list" with the value of the variable
|
||||||
`music_file_list`.
|
`music_file_list`.
|
||||||
"""
|
"""
|
||||||
return jsonify({"music_file_list": MASTER_TIMEOUT})
|
return jsonify({"music_file_list": "MASTER_TIMEOUT"})
|
||||||
|
|
||||||
@app.route("/conjurer", methods=["GET"])
|
@app.route("/conjurer", methods=["GET"])
|
||||||
def answer_external_command():
|
def answer_external_command():
|
||||||
@@ -38,7 +40,7 @@ def flask_debug(_logger):
|
|||||||
"""
|
"""
|
||||||
# trunk-ignore(bandit/B201)
|
# trunk-ignore(bandit/B201)
|
||||||
_logger.info("Attempt debug")
|
_logger.info("Attempt debug")
|
||||||
app.run(debug=True, use_reloader=False, host=HOST_ADDRESS, port=PORT_ADDRESS)
|
app.run(debug=True, use_reloader=False, host=HOST_ADDRESS, port=PORT_ADDRESS, logger=_logger)
|
||||||
|
|
||||||
|
|
||||||
def waitress_run(_logger):
|
def waitress_run(_logger):
|
||||||
@@ -47,15 +49,15 @@ def waitress_run(_logger):
|
|||||||
and port 5000 using the Waitress WSGI server.
|
and port 5000 using the Waitress WSGI server.
|
||||||
"""
|
"""
|
||||||
_logger.info("Attempt waitress")
|
_logger.info("Attempt waitress")
|
||||||
serve(app, host=HOST_ADDRESS, port=PORT_ADDRESS)
|
serve(app, host=HOST_ADDRESS, port=PORT_ADDRESS, logger=_logger)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
logger = logging.getLogger('conjurer_musician')
|
logger = logging.getLogger('conjurer_musician')
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
logger.info("Started")
|
logger.info("Started")
|
||||||
threads = []
|
threads = []
|
||||||
threads.append(threading.Thread(target=waitress_run, logger=logger))
|
threads.append(threading.Thread(target=waitress_run, args=(logger,)))
|
||||||
#threads.append(threading.Thread(target=flask_debug, logger=logger))
|
#threads.append(threading.Thread(target=flask_debug, logger))
|
||||||
|
|
||||||
for worker in threads:
|
for worker in threads:
|
||||||
worker.start()
|
worker.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user