def process(action, hash_item): if action == 'delete': Queue.delete(hash_item) return 'deleted' elif action == 'play': q_item = Queue.get(hash_item) response = api_client.process(q_item) return jsonify(response) elif action == 'suspend': q_item = Queue.get(hash_item) q_item.status = 'suspend' Queue.update(q_item) return f"{q_item.hash_item} {action}ed"
def update_queue(): q = Queue.get("27f1daa58b456bb0702bae8575a9ec1e") q.status = "error" Queue.update(q) return show_queue("update")