Exemplo n.º 1
0
def pause_media(slots, session):
    mc = cast.media_controller

    if not mc.status.player_is_playing:
        return alexandra.respond("Already paused")

    mc.pause()
    return alexandra.respond()
Exemplo n.º 2
0
def play_media(slots, session):
    mc = cast.media_controller

    if mc.status.player_is_playing:
        return alexandra.respond("Already playing")

    mc.play()
    return alexandra.respond()
Exemplo n.º 3
0
def skip_media(slots, session):
    mc = cast.media_controller

    if not mc.status.supports_skip_forward:
        return alexandra.respond("Skipping not supported")

    mc.skip()
    return alexandra.respond()
Exemplo n.º 4
0
def play_media(slots, session):
    mc = cast.media_controller

    if mc.status.player_is_playing:
        return alexandra.respond("Already playing")

    mc.play()
    return alexandra.respond()
Exemplo n.º 5
0
def set_default_board_intent(slots, session):
    board = slots['Board']
    client = trello_client(session)
    boards = [l.name for l in client.list_boards()]
    if not board or board not in boards:
        return alexandra.respond(f"Invalid board {board}")
    # TODO: persist change to DB
    return alexandra.respond(f"Set the board {board} as default")
Exemplo n.º 6
0
def skip_media(slots, session):
    mc = cast.media_controller

    if not mc.status.supports_skip_forward:
        return alexandra.respond("Skipping not supported")

    mc.skip()
    return alexandra.respond()
Exemplo n.º 7
0
def pause_media(slots, session):
    mc = cast.media_controller

    if not mc.status.player_is_playing:
        return alexandra.respond("Already paused")

    mc.pause()
    return alexandra.respond()
Exemplo n.º 8
0
def reconnect(slots, session):
    global cast

    cast = pychromecast.get_chromecast(friendly_name=device_name)

    if cast is None:
        return alexandra.respond("Failed to connect to Chromecast named %s." % device_name)

    return alexandra.respond("Reconnected.")
Exemplo n.º 9
0
def reconnect(slots, session):
    global cast

    cast = pychromecast.get_chromecast(friendly_name=device_name)

    if cast is None:
        return alexandra.respond(
            'Failed to connect to Chromecast named %s.' % device_name)

    return alexandra.respond('Reconnected.')
Exemplo n.º 10
0
def swipe_right(slots, session):
    command = slots["Command"]
    if command == 'friends':
        friends = list()
        for friend in users[current_index].common_connections:
            friends.append(friend['name'])
        return alexandra.respond("".join([friend for friend in friends] ))
    else:
        interests = list()
        for friend in users[current_index].common_interests:
            interests.append(friend['name'])
        return alexandra.respond("".join([interest for interest in interests] ))
Exemplo n.º 11
0
def set_state(slots, session):
    """Implements the SetPowerState intent, allowing you to ask the skill
    to 'turn [on|off]' using phrasing dictated in your utterances.

    """
    receiver = get_receiver(rxv_ip)
    state = slots['State']
    if state in ['on', 'off']:
        receiver.on = state == "on"
        return alexandra.respond("Powering {}".format(state))
    else:
        return alexandra.respond("You need to tell me to power on or off")
Exemplo n.º 12
0
def swipe_left(slots, session):
    direction = slots['Direction']
    if direction == "left":
        users[current_index].dislike()
        current_index += 1
        if current_index >= len(users):
            refresh_users()
            current_index = 0
        return alexandra.respond("Swiped left!")
    else:
        users[current_index].like()
        current_index += 1
        if current_index >= len(users):
            refresh_users()
            current_index = 0
        return alexandra.respond("Swiped right!")
Exemplo n.º 13
0
def get_name_intent(slots, session):
    name = name_map.get(session.user_id)

    if name:
        return alexandra.respond('You are %s, of course!' % name)

    return alexandra.reprompt("We haven't met yet! What's your name?")
Exemplo n.º 14
0
def set_volume(slots, session):
    """Implements the SetVolume intent. Depending on the slot values,
    turns the receiver volume up and down at varying granularities described
    below:


    'turn it [down|up]': tick the volume 5.0 decibels up or down.

    'turn it [down|up] [a little|a bit|a tad]': tick the volume 2.0 decibels
    up or down.

    'turn it [down|up] [a lot|a bunch]': tick the volume 10.0 decibels up or
    down.

    You'll receive a response indicating that it understood exactly whats
    you meant.

    """
    receiver = get_receiver(rxv_ip)
    direction = slots['Direction']
    valid_tweaks = ['a lot', 'a bunch', 'a little', 'a bit', 'a tad']
    tweak = slots.get('VolumeTweak', "")
    if tweak not in valid_tweaks:
        tweak = ''
    current_volume = receiver.volume
    if tweak == "a lot" or tweak == "a bunch":
        vol = 10.0
    elif tweak == "a little" or tweak == "a bit" or tweak == "a tad":
        vol = 2.0
    else:
        vol = 5.0

    if direction == 'up':
        new_volume = current_volume + vol
        if new_volume >= -100:
            receiver.volume = new_volume
            return alexandra.respond("Turning it up {}".format(tweak))
        else:
            return alexandra.respond("Can't turn it up this high")
    else:
        new_volume = current_volume - vol
        if new_volume <= -1:
            receiver.volume = new_volume
            return alexandra.respond("Turning it down {}".format(tweak))
        else:
            return alexandra.respond("Can't turn it down this low")
Exemplo n.º 15
0
def set_input(slots, session):
    """Implements the SetInput intent.

    This one expects that you've already mapped your `RecieverInputs` slot
    values in the input_mappings.json file and Amazon Echo Skill config. It
    is a simple mapping of recognizable words to actual Yamaha input names.

    Example usage given my input mappings would be 'switch to chromecast'.

    """
    input = slots['Input'].lower()

    if input in input_map:
        receiver = get_receiver(rxv_ip)
        actual_input = input_map[input]
        receiver.input = actual_input
        return alexandra.respond("Switched input to {}".format(actual_input))
    else:
        return alexandra.respond("Input not recognized")
Exemplo n.º 16
0
def service_alert(slots, context):
    route = slots.get("Route")
    if not route:
        response = "Did not get any Route information from request."
    elif route.is_empty:
        response = "Did not match to Route slot."
    elif not route.is_match:
        response = f"Do not recognize route {route.original_value}."
    else:
        response = f"Getting alerts for route {route.matched_value}."

    return alexandra.respond(response)
Exemplo n.º 17
0
def record_intent(slots, session):
    skyremote.press(stbip, "record")
    return alexandra.respond("Recording")
Exemplo n.º 18
0
def stop_intent(slots, session):
    skyremote.press(stbip, "stop")
    return alexandra.respond("Stopping")
Exemplo n.º 19
0
def play_intent(slots, session):
    skyremote.press(stbip, "play")
    return alexandra.respond("Playing")
Exemplo n.º 20
0
def pause_intent(slots, session):
    skyremote.press(stbip, "pause")
    return alexandra.respond("Pausing")
Exemplo n.º 21
0
def launch_handler(item):
    return alexandra.respond(ssml="<speak><audio src='https://alexa.systemadmin.es/octoalert48.mp3'/></speak>")
Exemplo n.º 22
0
def fallback(slots, context):
    return alexandra.respond("Sorry, I didn't understand what asked for.")
Exemplo n.º 23
0
def select_intent(slots, session):
    skyremote.press(stbip, "select")
    return alexandra.respond("OK")
Exemplo n.º 24
0
def octoalert_intent():
    return alexandra.respond(ssml="<speak>42</speak>")
Exemplo n.º 25
0
def channel_intent(slots, session):
    print(slots['channelToSet'])
    response = skyremote.channel(stbip, slots['channelToSet'])
    return alexandra.respond(response)
Exemplo n.º 26
0
def launch_handler(item):
    return alexandra.respond(ssml="<speak>" + getRandom() + "</speak>")
Exemplo n.º 27
0
def octoalert_intent():
    return alexandra.respond(ssml="<speak>" + getRandom() + "</speak>")
Exemplo n.º 28
0
def profile_command():
    return alexandra.respond(users[current_index].bio)
Exemplo n.º 29
0
def home_intent(slots, session):
    skyremote.press(stbip, "home")
    return alexandra.respond("OK")
Exemplo n.º 30
0
def octoalert_intent():
    return alexandra.respond(ssml="<speak><audio src='https://alexa.systemadmin.es/octoalert48.mp3'/></speak>")
Exemplo n.º 31
0
def tvg_intent(slots, session):
    skyremote.press(stbip, "tvguide")
    return alexandra.respond("Launching TV Guide")
Exemplo n.º 32
0
def set_name_intent(slots, session):
    name = slots['Name']
    name_map[session.user_id] = name

    return alexandra.respond("Okay, I won't forget you, %s" % name)
Exemplo n.º 33
0
def dismiss_intent(slots, session):
    skyremote.press(stbip, "dismiss")
    return alexandra.respond("OK")
Exemplo n.º 34
0
def disable_subtitle(slots, session):
    mc = cast.media_controller
    mc.disable_subtitle()
    return alexandra.respond()
Exemplo n.º 35
0
def launch_handler(item):
    return alexandra.respond(ssml="<speak>42</speak>")
Exemplo n.º 36
0
def mute(slots, session):
    cast.set_volume_muted(1)
    return alexandra.respond()
Exemplo n.º 37
0
def launch_handler(session):
    print("Session: {}".format(str(session)))
    return alexandra.respond(
        "Hello, I'm a raspberry pi velcroed onto your freezer.")
Exemplo n.º 38
0
def list_boards_intent(slots, session):
    client = trello_client(session)
    boards = ', '.join(l.name for l in client.list_boards())
    return alexandra.respond(f"Listing your boards: {boards}")
Exemplo n.º 39
0
def reboot(slots, session):
    cast.reboot()
    return alexandra.respond()
Exemplo n.º 40
0
def increase_volume(slots, session):
    cast.volume_down(0.2)
    return alexandra.respond()
Exemplo n.º 41
0
def reboot(slots, session):
    cast.reboot()
    return alexandra.respond()
Exemplo n.º 42
0
def whats_the_yams():
    """An effective way to determine what the yams is."""
    return alexandra.respond("The yams is the power that be!"
                             " You can smell it when I'm walking down"
                             " the street!")