Fix json page (properly)
This commit is contained in:
parent
a526ed3cb3
commit
26e7f32763
1 changed files with 7 additions and 2 deletions
|
@ -278,8 +278,13 @@ def clear_channel_plan(channel: int):
|
||||||
|
|
||||||
|
|
||||||
@app.route("/player/<int:channel>/status")
|
@app.route("/player/<int:channel>/status")
|
||||||
def status(channel):
|
def channel_json(channel: int):
|
||||||
|
try:
|
||||||
|
return jsonify(status(channel))
|
||||||
|
except:
|
||||||
|
return status(channel)
|
||||||
|
|
||||||
|
def status(channel):
|
||||||
channel_to_q[channel].put("STATUS")
|
channel_to_q[channel].put("STATUS")
|
||||||
while True:
|
while True:
|
||||||
response = channel_from_q[channel].get()
|
response = channel_from_q[channel].get()
|
||||||
|
@ -287,7 +292,7 @@ def status(channel):
|
||||||
response = response[7:]
|
response = response[7:]
|
||||||
response = response[response.index(":")+1:]
|
response = response[response.index(":")+1:]
|
||||||
try:
|
try:
|
||||||
response = jsonify(json.loads(response))
|
response = json.loads(response)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue