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 delete_from_queue(hash_item): Queue.delete(hash_item) return show_queue("delete")