def play(): return_type = check_token(request) if return_type is not None: return return_type data = {'ok': False} flag = functions.get_daemon_status() if not flag: functions.start_daemon() data['daemon'] = functions.get_daemon_status() return jsonify(data), 200
def start(): return_type = check_token(request) if return_type is not None: return return_type data = {'ok': False} if not functions.get_daemon_status(): if functions.start_daemon(): data['ok'] = True data['daemon'] = functions.get_daemon_status() return jsonify(data), 200
def quit_daemon(): return_type = check_token(request) if return_type is not None: return return_type data = {'ok': False} flag = functions.get_daemon_status() if functions.quit_daemon(): data['ok'] = True data['daemon'] = flag return jsonify(data), 200
def queue(): return_type = check_token(request) if return_type is not None: return return_type flag = functions.get_daemon_status() data = {'ok': False} if 'path' not in request.json: return jsonify(data) if flag: return_ = functions.queue_tracks(request.json['path']) data['ok'] = True data['return'] = return_ return jsonify(data)
def do_action(): return_type = check_token(request) if return_type is not None: return return_type data = {'ok': False} if 'action' in request.json: action = request.json['action'] if action == 'pause' or action == 'unpause': data['ok'] = functions.pause_unpause() elif action == 'next': data['ok'] = functions.next_song() elif action == 'previous': data['ok'] = functions.prev_song() elif action == 'volume' and 'volume' in request.json: data['ok'] = functions.volume(request.json['volume']) data['daemon'] = functions.get_daemon_status() return jsonify(data), 200
def status(): flag = functions.get_daemon_status() status_ = functions.get_status() data = {'ok': True, 'daemon': flag, 'return': status_} return jsonify(data), 200