예제 #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()
예제 #2
0
파일: server.py 프로젝트: erik/alexacast
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()
예제 #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()
예제 #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()
예제 #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")
예제 #6
0
파일: server.py 프로젝트: erik/alexacast
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()
예제 #7
0
파일: server.py 프로젝트: erik/alexacast
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()
예제 #8
0
파일: server.py 프로젝트: erik/alexacast
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.")
예제 #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.')
예제 #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] ))
예제 #11
0
파일: __main__.py 프로젝트: Raynes/yams
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")
예제 #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!")
예제 #13
0
파일: server.py 프로젝트: nsdevaraj/heropy
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?")
예제 #14
0
파일: __main__.py 프로젝트: Raynes/yams
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")
예제 #15
0
파일: __main__.py 프로젝트: Raynes/yams
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")
예제 #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)
예제 #17
0
def record_intent(slots, session):
    skyremote.press(stbip, "record")
    return alexandra.respond("Recording")
예제 #18
0
def stop_intent(slots, session):
    skyremote.press(stbip, "stop")
    return alexandra.respond("Stopping")
예제 #19
0
def play_intent(slots, session):
    skyremote.press(stbip, "play")
    return alexandra.respond("Playing")
예제 #20
0
def pause_intent(slots, session):
    skyremote.press(stbip, "pause")
    return alexandra.respond("Pausing")
예제 #21
0
def launch_handler(item):
    return alexandra.respond(ssml="<speak><audio src='https://alexa.systemadmin.es/octoalert48.mp3'/></speak>")
예제 #22
0
def fallback(slots, context):
    return alexandra.respond("Sorry, I didn't understand what asked for.")
예제 #23
0
def select_intent(slots, session):
    skyremote.press(stbip, "select")
    return alexandra.respond("OK")
예제 #24
0
def octoalert_intent():
    return alexandra.respond(ssml="<speak>42</speak>")
예제 #25
0
def channel_intent(slots, session):
    print(slots['channelToSet'])
    response = skyremote.channel(stbip, slots['channelToSet'])
    return alexandra.respond(response)
예제 #26
0
def launch_handler(item):
    return alexandra.respond(ssml="<speak>" + getRandom() + "</speak>")
예제 #27
0
def octoalert_intent():
    return alexandra.respond(ssml="<speak>" + getRandom() + "</speak>")
예제 #28
0
def profile_command():
    return alexandra.respond(users[current_index].bio)
예제 #29
0
def home_intent(slots, session):
    skyremote.press(stbip, "home")
    return alexandra.respond("OK")
예제 #30
0
def octoalert_intent():
    return alexandra.respond(ssml="<speak><audio src='https://alexa.systemadmin.es/octoalert48.mp3'/></speak>")
예제 #31
0
def tvg_intent(slots, session):
    skyremote.press(stbip, "tvguide")
    return alexandra.respond("Launching TV Guide")
예제 #32
0
파일: server.py 프로젝트: nsdevaraj/heropy
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)
예제 #33
0
def dismiss_intent(slots, session):
    skyremote.press(stbip, "dismiss")
    return alexandra.respond("OK")
예제 #34
0
def disable_subtitle(slots, session):
    mc = cast.media_controller
    mc.disable_subtitle()
    return alexandra.respond()
예제 #35
0
def launch_handler(item):
    return alexandra.respond(ssml="<speak>42</speak>")
예제 #36
0
def mute(slots, session):
    cast.set_volume_muted(1)
    return alexandra.respond()
예제 #37
0
def launch_handler(session):
    print("Session: {}".format(str(session)))
    return alexandra.respond(
        "Hello, I'm a raspberry pi velcroed onto your freezer.")
예제 #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}")
예제 #39
0
def reboot(slots, session):
    cast.reboot()
    return alexandra.respond()
예제 #40
0
def increase_volume(slots, session):
    cast.volume_down(0.2)
    return alexandra.respond()
예제 #41
0
파일: server.py 프로젝트: erik/alexacast
def reboot(slots, session):
    cast.reboot()
    return alexandra.respond()
예제 #42
0
파일: __main__.py 프로젝트: Raynes/yams
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!")