コード例 #1
0
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
コード例 #2
0
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
コード例 #3
0
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
コード例 #4
0
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
コード例 #5
0
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
コード例 #6
0
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
コード例 #7
0
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)
コード例 #8
0
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)
コード例 #9
0
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
コード例 #10
0
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
コード例 #11
0
def status():
    flag = functions.get_daemon_status()
    status_ = functions.get_status()
    data = {'ok': True, 'daemon': flag, 'return': status_}
    return jsonify(data), 200
コード例 #12
0
def status():
    flag = functions.get_daemon_status()
    status_ = functions.get_status()
    data = {'ok': True, 'daemon': flag, 'return': status_}
    return jsonify(data), 200