add status to now-playing
This commit is contained in:
parent
66fca07ed2
commit
a019473647
1 changed files with 5 additions and 3 deletions
8
app.py
8
app.py
|
@ -128,7 +128,7 @@ def api_start():
|
|||
return jsonify("Laas is already lofi'ing"), 400
|
||||
else:
|
||||
playback_start()
|
||||
return jsonify('ok'), 200
|
||||
return jsonify("ok"), 200
|
||||
|
||||
|
||||
@app.route("/api/stop", methods=["POST"])
|
||||
|
@ -137,7 +137,7 @@ def api_stop():
|
|||
return jsonify("You cant stop when theres no playback, womp womp!"), 400
|
||||
else:
|
||||
playback_stop()
|
||||
return jsonify('ok'), 200
|
||||
return jsonify("ok"), 200
|
||||
|
||||
|
||||
@app.route("/api/status", methods=["GET"])
|
||||
|
@ -147,7 +147,7 @@ def api_status():
|
|||
|
||||
@app.route("/api/nowplaying", methods=["GET"])
|
||||
def api_nowplaying():
|
||||
response: dict[str, Any] = {}
|
||||
response: dict[str, Any] = {"status": "stopped"}
|
||||
|
||||
if is_playing():
|
||||
sock = socket.socket(socket.AF_UNIX)
|
||||
|
@ -158,6 +158,8 @@ def api_nowplaying():
|
|||
except (ConnectionRefusedError, FileNotFoundError):
|
||||
pass
|
||||
|
||||
response["status"] = "playing"
|
||||
|
||||
for prop in [
|
||||
"filename",
|
||||
("metadata/by-key/artist", "artist"),
|
||||
|
|
Loading…
Add table
Reference in a new issue