@@ -136,6 +136,19 @@ def api_mute():
|
||||
return jsonify({"target": key, "ok": True})
|
||||
|
||||
|
||||
@app.post("/api/playback")
|
||||
@handle_errors
|
||||
def api_playback():
|
||||
"""Start or stop a room. Send 'state' to be explicit, or leave it out to
|
||||
flip whatever the speakers are actually doing."""
|
||||
data = _payload()
|
||||
key = _target_from(data)
|
||||
state = data.get("state")
|
||||
if state is not None and state not in ("play", "pause", "stop"):
|
||||
raise ValueError("'state' must be play, pause or stop -- or left out to toggle")
|
||||
return jsonify({"target": key, "state": controller.toggle_play(key, state)})
|
||||
|
||||
|
||||
@app.post("/api/group")
|
||||
@handle_errors
|
||||
def api_group():
|
||||
|
||||
Reference in New Issue
Block a user