def mix(artist1, artist2):
    print("artist1, artist2 = ",artist1,artist2)
    all_tracks = [] 
    for artist in (artist1, artist2):
        if artist:
            s = 'artist:' + ' AND artist:'.join(artist.split())
            result = solr.search(s, fl='artist,title,uri', rows=500) 
            count = len(result)
            if count:
                print("Total track count for {} was {}".format(artist, count))
                tracks = result.docs
                k = 5 if count >= 5 else count
                selected_tracks = random.sample(tracks, k)
                all_tracks.append(selected_tracks)
            else:
                output_speech = "I couldn't find any tracks for {}".format(artist)
                return statement(output_speech)
        else:
            output_speech = "I couldn't find one or both of the artists you were looking for."
            return statement(output_speech)

    x = all_tracks[0]
    y = all_tracks[1]
    mix = [t for sublist in zip(x,y) for t in sublist]
    uris = [t.get('uri') for t in mix]
    msg = sonos_actions.play(False, uris)
    print("Mix return msg from zmq:", msg)
    titles_artists = ', '.join([t.get('title')+' - '+t.get('artist') for t in mix])
    return statement(f"I will shuffle {titles_artists}.")
def set_volume(level):
    if level > 0 and level < 70: 
        msg = sonos_actions.set_volume(level)
        print("SetVolume return msg from zmq:", msg)
        return statement("I will set the volume to {}.".format(level))
    else:
        return statement("{} is not in the range zero to seventy".format(level))
def recognize_image():
    """
    Takes an image and gets the image array.  Uses this array to detect the faces in the image.  Goes through the faces and 
    calculates the best match for each one by referencing the database.  Alexa then says who is in the image after some formatting
    Returns: People in the image 
    """
    img_array = get_image()
    facesGot = detect(img_array, False)
    bestMatches = []
    for face in facesGot:
        descript = face[0]
        bestMatch = db.computeMatches(descript, db.profiles)
        bestMatches.append(bestMatch)
    print(bestMatches)
    if len(bestMatches) == 1:
        image_msg = "The person in the image is {}".format(bestMatches[0])
        print(image_msg)
        return statement(image_msg)
    elif len(bestMatches) == 2:
        image_msg = "The person in the image is {}".format(bestMatches[0]) + " and " + "{}".format(bestMatches[1])
        return statement(image_msg)
    image_msg = "The person in the image is "
    for i in range(len(bestMatches) - 1):
        image_msg += "{}".format(bestMatches[i])
        image_msg += ", "
    image_msg += "and "
    image_msg += "{}".format(bestMatches[-1])
    print(image_msg)
    return statement(image_msg)
def mix(artist1, artist2):
    print "artist1, artist2 = ",artist1,artist2
    uris = []
    for artist in (artist1, artist2):
        if artist:
            s = 'artist:' + ' AND artist:'.join(artist.split())
            result = solr.search(s, fl='artist,title,uri', rows=500) 
            count = len(result)
            if count:
                print "Total track count for {} was {}".format(artist, count)
                tracks = result.docs
                k = 5 if count >= 5 else count
                selected_tracks = random.sample(tracks, k)
                uris.append([t.get('uri') for t in selected_tracks])
            else:
                output_speech = "I couldn't find any tracks for {}".format(artist)
                return statement(output_speech)
        else:
            output_speech = "I couldn't find one or both of the artists you were looking for."
            return statement(output_speech)

    iters = [iter(y) for y in uris]
    uris = list(it.next() for it in itertools.cycle(iters))
    socket.send_json({'action':'play', 'add':False, 'uris':uris})
    msg = socket.recv()
    print "Mix return msg from zmq:", msg
    output_speech = "I will shuffle mix songs by {} and {}.".format(artist1, artist2)
    return statement(output_speech)
def set_volume(level):
    if level > 0 and level < 70: 
        socket.send_json({'action':'set_volume', 'level':level})
        msg = socket.recv()
        print "SetVolume return msg from zmq:", msg
        return statement("I will set the volume to {}.".format(level))
    else:
        return statement("{} is not in the range zero to seventy".format(level))
def turn_the_volume(volume):
    if volume in ('increase','louder','higher','up'):
        conn.send({'action':'louder'})
        return statement("I will turn the volume up.")
    elif volume in ('decrease', 'down','quieter','lower'):
        conn.send({'action':'quieter'})
        return statement("I will turn the volume down.")
    else:
        return statement("I don't know what you asked me to do to the volume.")
Exemple #7
0
def Gpio_Intent(status,room):
    print status
    print room
    if status in STATUSON:
       #GPIO.output(17,GPIO.HIGH)
       return statement('turning {} lights'.format(status))
    elif status in STATUSOFF:
        #GPIO.output(17,GPIO.LOW)
        return statement('turning {} lights'.format(status))
    else:
        return statement('Sorry not possible.')
def turn_volume(volume):
    if volume in ('increase','louder','higher','up'):
        msg = sonos_actions.turn_volume('louder')
        print("Volume return msg from zmq:", msg)
        return statement("I will turn the volume up.")
    elif volume in ('decrease', 'down','quieter','lower'):
        msg = sonos_actions.turn_volume('quieter')
        print("Volume return msg from zmq:", msg)
        return statement("I will turn the volume down.")
    else:
        return statement("I don't know what you asked me to do to the volume.")
Exemple #9
0
def no_debug():
	img = take_picture()
	combined = get_cards(img, debug = False)
	print(combined, flush = True)
	if len(combined)==0:
		return statement("I don't see a card")
	if len(combined) == 1:
		return statement("You have a {} of {}".format(*(combined[0])))
	msg = say_cards(combined)
	print(msg, flush = True)
	return statement(msg)
Exemple #10
0
def add_child(name):
    if name is None:
        return question(render_template("child_name")).reprompt(render_template("child_name_reprompt"))
    user_token = session.user.accessToken
    endpoint = "/api/child"
    r = requests.post(BASE+endpoint,
                      headers={'Authorization': 'Basic %s' % b64encode(bytes(user_token+":"))},
                      data={'name': name})
    if r.status_code != 200:
        return statement(render_template("failed_request"))
    resp = f"{name} was added as your child"
    return statement(resp).simple_card(resp)
def turn_volume(volume):
    if volume in ('increase','louder','higher','up'):
        socket.send_json({'action':'turn_volume', 'volume':'louder'})
        msg = socket.recv()
        print "Volume return msg from zmq:", msg
        return statement("I will turn the volume up.")
    elif volume in ('decrease', 'down','quieter','lower'):
        socket.send_json({'action':'turn_volume', 'volume':'quieter'})
        msg = socket.recv()
        print "Volume return msg from zmq:", msg
        return statement("I will turn the volume down.")
    else:
        return statement("I don't know what you asked me to do to the volume.")
Exemple #12
0
def location_control(environment):

    hum, temp = getSensorData()
    h = float(hum)
    t = float(temp)
    if environment in ['temperature', 'temp']:
        return statement('Temperature is {0:.2f}'.format(t))
    elif environment in ['humidity', 'hum']:
        return statement('Humidity is {0:.2f}'.format(h))
    elif environment in ['all']:
        return statement(
            'Temperature is {0:.2f} and Humidity is {0:.2f}'.format(t, h))
    else:
        return statement('I cannot find the data you want')
def model_answer(spoken_model):

    alldata = loader_util.load_data_from_s3()

    model = spoken_model;

    result = query_util.find_matches_by_model(alldata, model)

    if result.getlen() < 1:
        session.attributes['answer'] = "No match"
        msg = render_template('no_matching_models', model=model)
        return question(msg)
    else:
        session.attributes['model'] = model   

    # session.attributes['product'] can be unset or empty; check for empty
    try:
        if session.attributes['product'] == "":
            # remove it because it is empty
            session.attributes.pop('product')
    except KeyError:
        # it's unset. Do something meaningless to handle the expected KeyError
        session.attributes['answer'] = ""
        
    # session.attributes['product'] can be unset.
    # We know it isn't empty because we checked above.
    try:
        # if this succeeds, we're querying for a model and we already know
        # the product... so query for a product+model combination
        product=session.attributes['product']
        result = query_util.find_matches_by_product_model(alldata, product, model)

        if result.getlen() < 1:
            session.attributes['answer'] = "No match"
            msg = render_template('no_matching_product_model', product=product, model=model)
        else:
            session.attributes['answer'] = result.toSimpleString()
            msg = render_template('read_matches', result=session.attributes['answer'])
            return statement(msg)
        
    except KeyError:
        # it's unset. This means we're querying for a model WITHOUT knowing product.
        
        # we alredy have the query from above so we just store the answer
        session.attributes['answer'] = result.toSimpleString()
        msg = render_template('read_matches', result=session.attributes['answer'])
        return statement(msg)

    return question(msg)
Exemple #14
0
def gpio_control(status, pin):

    try:
        pinNum = int(pin)
    except Exception as e:
        return statement('Pin number not valid.')

    GPIO.setup(pinNum, GPIO.OUT)

    if status in ['on', 'high']:
        GPIO.output(pinNum, GPIO.HIGH)
    if status in ['off', 'low']:
        GPIO.output(pinNum, GPIO.LOW)

    return statement('Turning pin {} {}'.format(pin, status))
def play_album(album, artist):
    # album must be present; artist is optional

    print("album =",album)
    print("artist=",artist)

    if album:
        s = 'album:' + ' AND album:'.join(album.split())
        if artist:
            s = s + ' artist:' + ' AND artist:'.join(artist.split())

        result = solr.search(s, fl='score,track,uri,album,title', sort='score desc', rows=25) #**{'rows':25}) #only brings back actual matches but 25 seems like max for most albums
        tracks = result.docs
        if  tracks:
            selected_album = tracks[0]['album']
            try:
                tracks = sorted([t for t in tracks],key=itemgetter('track'))
            except KeyError:
                pass
            # The if t['album']==selected_album only comes into play if we retrieved more than one album
            selected_tracks = [t for t in tracks if t['album']==selected_album]
            uris = [t.get('uri') for t in selected_tracks]
            msg = sonos_actions.play(False, uris)
            print("PlayAlbum return msg from zmq:", msg)
            titles = ', '.join([t.get('title', '') for t in selected_tracks])
            output_speech = f"I will play {len(uris)} tracks from {selected_album}: {titles}"
        else:
            output_speech = "I couldn't find any songs from album {}.".format(album)

    else:
        output_speech = "I couldn't even find the album."

    return statement(output_speech)
def product_model_answer(spoken_product, spoken_model):

    product = spoken_product;
    model = spoken_model;

    #if 'product' in convert_errors:
        # something happened and product may be garbage
        # value (e.g. "?") for later interrogation.
        #return question(render_template('repeat_product'))

    session.attributes['product'] = product
     
    #if 'model' in convert_errors:
        # something happened and model may be garbage
        # value (e.g. "?") for later interrogation.
        #return question(render_template('repeate_model'))

    session.attributes['model'] = model

    alldata = loader_util.load_data_from_s3()

    result = query_util.find_matches_by_product_model(alldata, product, model)
    
    #msg = render_template('verify_input',
    #                      product=session.attributes['product'],
    #                      model=session.attributes['model'])

    if result.getlen() < 1:
        session.attributes['answer'] = "No match"
        msg = render_template('no_matching_product_model', product=product, model=model)
    else:
        session.attributes['answer'] = result.toSimpleString()
        msg = render_template('read_matches', result=session.attributes['answer'])

    return statement(msg)
def declare_wrong_answer():

    msg = render_template('wrong')
    session.attributes['product'] = ""
    session.attributes['model'] = ""

    return statement(msg)
Exemple #18
0
def restart_track():
    if queue.current:
        speech = 'Restarting current track'
        dump_stream_info()
        return audio(speech).play(queue.current, offset=0)
    else:
        return statement('There is no current song')
def play_album(album, artist):
    # album must be present; artist is optional

    print "album =",album
    print "artist=",artist

    if album:
        s = 'album:' + ' AND album:'.join(album.split())
        if artist:
            s = s + ' artist:' + ' AND artist:'.join(artist.split())

        result = solr.search(s, fl='score,track,uri,album', sort='score desc', rows=25) #**{'rows':25}) #only brings back actual matches but 25 seems like max for most albums
        tracks = result.docs
        if  tracks:
            selected_album = tracks[0]['album']
            try:
                tracks = sorted([t for t in tracks],key=itemgetter('track'))
            except KeyError:
                pass
            # The if t['album']==selected_album only comes into play if we retrieved more than one album
            uris = [t['uri'] for t in tracks if t['album']==selected_album]

            socket.send_json({'action':'play', 'add':False, 'uris':uris})
            msg = socket.recv()
            print "PlayAlbum return msg from zmq:", msg

            output_speech = "Using Flask Ask, I will play {} songs from {}".format(len(uris), selected_album)
        else:
            output_speech = "I couldn't find any songs from album {}.".format(album)

    else:
        output_speech = "I couldn't even find the album."

    return statement(output_speech)
Exemple #20
0
def store_password():
    """
    Gets an image and then detects the face.  If the database is empty, then it immediately prompts for your name to create a new
    profile.  If the database is not empty but the computer can not recognize you, it prompts for your name to create a new profile. 
    Otherwise, it asks you which website do you want to save the password to.   
    """
    global descript
    global Boolean 
    global FaceGot
    img_array = get_image()
    FaceGot = detect(img_array, False)
    if (len(FaceGot) > 1):
        return statement("Sorry there are multiple people behind you")
    global BestMatch
    #print(len(db.profiles), flush = True)
    if (not(len(db.profiles)) == 0):
        #print((FaceGot[0])[0],flush = True)
        BestMatch = db.computeMatches((FaceGot[0])[0], db.profiles)
        #print(BestMatch, flush = True)
        if (BestMatch in db.profiles):
            msg = "What website do you want to save a password to. After you enter a website, follow the instructions in the computer console"
            return question(msg)
        else:
            Boolean = True
            msg = "Tell me your name"
            return question(msg)
    else: 
        Boolean = True
        msg = "Tell me your name"
        return question(msg)
Exemple #21
0
def _make_tide_request(city, date):
    station = STATIONS.get(city.lower())
    noaa_api_params = {
        "station": station,
        "product": "predictions",
        "datum": "MLLW",
        "units": "english",
        "time_zone": "lst_ldt",
        "format": "json",
    }
    if date == datetime.date.today():
        noaa_api_params["date"] = "today"
    else:
        noaa_api_params["begin_date"] = date.strftime("%Y%m%d")
        noaa_api_params["range"] = 24
    url = ENDPOINT + "?" + urlencode(noaa_api_params)
    resp_body = urlopen(url).read()
    if len(resp_body) == 0:
        statement_text = render_template("noaa_problem")
    else:
        noaa_response_obj = json.loads(resp_body)
        predictions = noaa_response_obj["predictions"]
        tideinfo = _find_tide_info(predictions)
        statement_text = render_template("tide_info", date=date, city=city, tideinfo=tideinfo)
    return statement(statement_text).simple_card("Tide Pooler", statement_text)
Exemple #22
0
def get_first_event(day):
    month_name = day.strftime("%B")
    day_number = day.day
    events = _get_json_events_from_wikipedia(month_name, day_number)
    if not events:
        speech_output = "There is a problem connecting to Wikipedia at this time. Please try again later."
        return statement("<speak>{}</speak>".format(speech_output))
    else:
        card_title = "Events on {} {}".format(month_name, day_number)
        speech_output = "<p>For {} {}</p>".format(month_name, day_number)
        card_output = ""
        for i in range(PAGINATION_SIZE):
            speech_output += "<p>{}</p>".format(events[i])
            card_output += "{}\n".format(events[i])
        speech_output += " Wanna go deeper into history?"
        card_output += " Wanna go deeper into history?"
        reprompt_text = (
            "With History Buff, you can get historical events for any day of the year. "
            + "For example, you could say today, or August thirtieth. "
            + "Now, which day do you want?"
        )
        session.attributes[SESSION_INDEX] = PAGINATION_SIZE
        session.attributes[SESSION_TEXT] = events
        speech_output = "<speak>{}</speak>".format(speech_output)
        return question(speech_output).reprompt(reprompt_text).simple_card(card_title, card_output)
def _make_tide_request(city, date):
    station = STATIONS.get(city.lower())
    noaa_api_params = {
        'station': station,
        'product': 'predictions',
        'datum': 'MLLW',
        'units': 'english',
        'time_zone': 'lst_ldt',
        'format': 'json'
    }
    if date == datetime.date.today():
        noaa_api_params['date'] = 'today'
    else:
        noaa_api_params['begin_date'] = date.strftime('%Y%m%d')
        noaa_api_params['range'] = 24
    url = ENDPOINT + "?" + urlencode(noaa_api_params)
    resp_body = urllib.request.urlopen(url).read()
    if len(resp_body) == 0:
        statement_text = render_template('noaa_problem')
    else:
        noaa_response_obj = json.loads(resp_body)
        predictions = noaa_response_obj['predictions']
        tideinfo = _find_tide_info(predictions)
        statement_text = render_template('tide_info', date=date, city=city, tideinfo=tideinfo)
    return statement(statement_text).simple_card("Tide Pooler", statement_text)
Exemple #24
0
def rank_img():
	img = take_picture()
	combined = get_cards(img)
	print(combined, flush = True)
	msg = rank_hand(combined)
	print(msg, flush = True)
	return statement(msg)
Exemple #25
0
def launch():
    print "wifi skill launch"
    speech = "The wireless network name is "+(' '.join(ssid))+", and the password is "+(' '.join(password))+"."
    #return statement(speech) # in case you don't want to return the card
    card_title = "Get on the WiFi"
    card_text = "Network: "+ssid+"\nPassword: "+ password
    return statement(speech).simple_card(title=card_title, content=card_text)
Exemple #26
0
def play_back_finished():
    _infodump('Finished Audio stream for track {}'.format(queue.current_position))
    if queue.up_next:
        queue.step()
        _infodump('stepped queue forward')
        dump_stream_info()
    else:
        return statement('You have reached the end of the playlist!')
def shuffle(artist):
    if not artist:
        return statement("I couldn't find the artist you were looking for.  Sorry.")

    s = 'artist:' + ' AND artist:'.join(artist.split())
    result = solr.search(s, fl='artist,title,uri', rows=500) 
    count = len(result)
    if not count:
        return statement("I couldn't find any tracks for {}".format(artist))

    print "Total track count for {} was {}".format(artist, count)
    tracks = result.docs
    k = 10 if count >= 10 else count
    selected_tracks = random.sample(tracks, k)
    uris = [t.get('uri') for t in selected_tracks]
    conn.send({'action':'play', 'uris':uris})
    return statement("I will shuffle songs by {}.".format(artist))
Exemple #28
0
def delete_child(name):
    if name is None:
        return question(render_template("child_name")).reprompt(render_template("child_name_reprompt"))
    user_token = session.user.accessToken
    endpoint = "/api/child"
    child = name_to_id(name, user_token)
    if "children" in child:
        text = render_template("multiple_name")
        return statement(text).simple_card(text)
    child_id = child["_id"]
    r = requests.delete(BASE+endpoint,
                        headers={'Authorization': 'Basic %s' % b64encode(bytes(user_token+":"))},
                        data={'child_id': child_id})
    if r.status_code != 200:
        return statement(render_template("failed_request"))
    resp = f"{name} was deleted"
    return statement(resp).simple_card(resp)
Exemple #29
0
def whats_my_color():
    card_title = render_template('card_title')
    color = session.attributes.get(COLOR_KEY)
    if color is not None:
        statement_text = render_template('known_color_bye', color=color)
        return statement(statement_text).simple_card(card_title, statement_text)
    else:
        question_text = render_template('unknown_color_reprompt')
        return question(question_text).reprompt(question_text).simple_card(card_title, question_text)
def alexa_launch_game(game_title):
    """Launch the desired GameStream App"""
    card_title = render_template('card_title')
    if game_title is not None:
      statement_msg = render_template('known_game', game=game_title.title())
      launch_game(game_title.title())
      return statement(statement_msg).simple_card(card_title, statement_msg)
    else:
      question_msg = render_template('unknown_game')
      return question(question_msg).simple_card(card_title, question_msg)
def genre_picked(specificGenre):
    session.attributes['state'] = specificGenreTrans[
        session.attributes['state']]
    return statement(
        "Looking for people to watch {} movies with.".format(specificGenre))
Exemple #32
0
def showRecipe(recipe):
    fmtRecipe = recipe.replace(" ", "")
    print(fmtRecipe)
    webbrowser.get('firefox').open('http://localhost:5000/recipe/' + fmtRecipe)
    message = "opening your" + recipe + " recipe"
    return statement(message)
Exemple #33
0
def readCookBook():
    recipes = Recipe.query.all()
    recipesList = listify(recipes)
    fmtRecipesList = commaFormat(recipesList)
    message = "The recipes in your cookbook are {}".format(fmtRecipesList)
    return statement(message)
Exemple #34
0
def category_dish_search(category, cuisine):
    print 'inside category search'
    text = getcategorydish(category, cuisine)
    print text
    return statement(text)
Exemple #35
0
def gen_compliment():
    with open("lm_comps.pkl", mode="rb") as f:
        lm = pickle.load(f)

    return statement(generate_sentence(lm, 8))
Exemple #36
0
def previous_step():
    print 'inside previous step'
    step = readPrev('recipeSteps.txt')
    print step
    return statement(step)
Exemple #37
0
def listen_results():
    print 'Inside listen_results'
    res = returnResults('dishsearchresult.txt')
    print res
    return statement(res)
Exemple #38
0
def setIntent(value):
    intentData = getIntentValue("setIntent")
    text = intentData["responseText"]
    mqtt.publish(intentData["request"],
                 intentData["requestPayload"].format(value))
    return statement(text)
Exemple #39
0
def no_intent():
    bye_text = 'oh okay... bye'
    return statement(bye_text)
def no_intent():
    bye_text = 'I am not sure why you asked me to run then, but okay... bye'
    return statement(bye_text)
Exemple #41
0
def led_on_controller():
    result = 'Hi. My name is Skyler. Nice to meet you.'
    return statement(result).simple_card('skyler', result)
def share_headlines():
    headlines = get_headlines()
    headline_msg = 'The current casual Ireland headlines are {}'.format(
        headlines)
    return statement(headline_msg)
Exemple #43
0
def noalarm():
    print "no alarm"
    sleep = render_template("sleep_on")
    return statement(sleep)
Exemple #44
0
def start():
    print "start"
    return statement("Welcome")
Exemple #45
0
def help_intent():
    return statement("You want help")		#same here don't use CancelIntent
Exemple #46
0
def share_headlines():
    string_msg = 'oh you say yes'
    return statement(string_msg)
Exemple #47
0
def cancel_intent():
    return statement("You want to cancel")	#don't use CancelIntent as title it causes code reference error during certification
Exemple #48
0
def ip(device):
    f = os.popen('hostname -I | cut -d\' \' -f1')
    ip = str(f.read())
    text = 'the ip server ' + str(ip)
    return statement(text)
Exemple #49
0
def next_step():
    print 'inside next step'
    step = readNext('recipeSteps.txt')
    print step
    return statement(step)
def switch_stop():
    response = d["stop_template"]
    # ser.write(b'L')
    return statement(response)
Exemple #51
0
def get_dish_ing(dishname):
    ing = ingFunc.getIngList(dishname)
    return statement(ing)
Exemple #52
0
def HaltIntent(STATION, TRANSPORT, ARTIKEL):
    global flag
    global fileOpt
    global fileSet
    global fileChg

    if not fileInit:
        initData()

    station = None
    if STATION != None:
        station = avv.searchForStation(STATION)
    elif fileOpt["favorite"] == "None":
        flag = "setFavStation"
        return question(
            "Du hast keinen Favoriten angegeben... Welche Station möchtest du als Favorit auswählen?"
        )
    else:
        station = avv.searchForStation(fileOpt["favorite"])

    data = None
    if station["match"]:
        data = avv.getStationBoard(station["obj"])
    else:
        print("Error")
        return statement("Das konnte ich leider nicht verstehen!")

    sorKeys = sorted(data.keys())
    ret_msg = "<speak>" + random.choice(fileSet["intro"].replace(
        station["obj"]["name"]))
    for group in sorKeys:
        lines = []
        for element in data[group]:
            if group == "None":
                break
            element = data[group][element]
            data_lex = {
                "name": element["type"]["name"],
                "dirText": element["dirText"],
                "del": "..."
            }
            # Platform
            if group.startswith("H"):
                data_lex["pltName"] = group.replace("H.", "Haltestelle ")
            else:
                data_lex["pltName"] = "Gleis " + str(group)

            # Time
            time = avv.convertTime(element["dep"]["time"])
            data_lex["dep_hours"] = time[0]
            data_lex["dep_minutes"] = time[1]

            if element["dep"]["time"] != element["dep"]["delay"]:
                time_del = avv.convertTime(element["dep"]["delay"])
                data_lex["del_hours"] = time_del[0]
                data_lex["del_minutes"] = time_del[1]
                if time[0] * 60 + time[1] < time_del[0] * 60 + time_del[1]:
                    data_lex["del_extMin"] = ((
                        (24 - time[0]) * 60) + time[1]) + (
                            (time_del[0] * 60) + time_del[1])
                data_lex["del"] = random.choice(
                    fileSet["board"]["sentences"]["delMsg"]).format(data_lex)

            if len(lines) == 0:
                lines.append(
                    random.choice(fileSet["board"]["sentences"]
                                  ["newPlt"]).format(data_lex))
            elif len(lines) >= fileSet["board"]["maxItems"]:
                break
            else:
                lines.append(
                    random.choice(fileSet["board"]["sentences"]
                                  ["fromPlt"]).format(data_lex))
        first = True
        for i in lines:
            if ret_msg == "<speak>":
                ret_msg += i
                first = False
            elif first:
                first = False
                ret_msg += """<break time="1.5s"/> """ + i
            else:
                ret_msg += """<break time="0.5s"/>""" + i
    ret_msg += "</speak>"
    return statement(ret_msg)
Exemple #53
0
def no_intent():
    bye_text = 'Okay, goodbye'
    return statement(bye_text)
Exemple #54
0
def AmazonStopIntent():
    return statement("")
Exemple #55
0
def showGroceryList():
    webbrowser.get('firefox').open('http://localhost:5000/grocery-list/')
    message = ("I'm opening your grocery list on your device")
    return statement(message)
Exemple #56
0
def end():
    speech = 'Goodbye!'
    logger.info('speech = {}'.format(speech))
    return statement(speech)
Exemple #57
0
def showCookBook():
    webbrowser.get('firefox').open('http://localhost:5000/cookbook/')
    message = "opening your cookbook"
    return statement(message)
Exemple #58
0
def stop_intent():
    return statement("You want to stop")		#here also don't use StopIntent
def band_picked(bandPicked):
    session.attributes['state'] = specificMusicTrans[
        session.attributes['state']]
    return statement(
        "Looking for people to go to {}'s concert with.".format(bandPicked))
def movie_picked(moviePicked):
    session.attributes['state'] = specificMovieTrans[
        session.attributes['state']]
    return statement(
        "Looking for people to watch {} with.".format(moviePicked))