add status to now-playing

This commit is contained in:
deneb 2025-02-25 22:30:59 +01:00
parent 66fca07ed2
commit a019473647

8
app.py
View file

@ -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"),