Exemplo n.º 1
0
def tell_news(category):
    page = requests.get(urls[category])
    soup = BeautifulSoup(page.content, 'html.parser')
    headlines_list = soup.find_all('h3', class_='story-title')
    for headlines in headlines_list:
        tts.operation(headlines.get_text())
        time.sleep(1)
Exemplo n.º 2
0
def ir_operation(r_name, f_name):
    f_name = f_name.replace(' ', '_')
    print(f_name)
    key = ir_helper.get_key(r_name, f_name)
    if (not key):
        tts.operation("Either Device or function is incorrect")
    else:
        print(key)
        ir_helper.send_code(r_name, key)
        tts.operation("Command send to " + r_name)
Exemplo n.º 3
0
def play_music(query_text, driver):
    tts.operation('playing song')
    music.play_song(query_text, driver)
    #check stop command
    while True:
        speech_to_text.resetSTT(driver)
        if speech_to_text.invoke(driver, 'stop'):
            #user said stop
            music.stop_song(driver)
            return
        else:
            #user did not said stop in n tries
            speech_to_text.resetSTT(driver)
Exemplo n.º 4
0
def main():
    text_to_speech.operation(
        'Hello There! Wait for a while to let me set things up.')
    #get profile data from firebase
    profile = fb.get('/profile', None)
    #initialize STT for the first time
    speech_to_text.resetSTT(driver)
    #welcome message
    text_to_speech.operation('Hello ' + profile['name'] +
                             '. How can I help you?')
    while True:
        if speech_to_text.invoke(driver, 'listen'):
            #user said listen
            text_to_speech.operation('Yes, say it')
            rec_text = speech_to_text.operation(driver)
            think(rec_text, driver)
        else:
            #user did not said listen in n tries
            speech_to_text.resetSTT(driver)
Exemplo n.º 5
0
def unknown_request():
    tts.operation("Sorry I don't know this.")
Exemplo n.º 6
0
def get_req_news(category):
    tts.operation('fetching latest news')
    news_helper.tell_news(category)
    tts.operation('this was all for today')
Exemplo n.º 7
0
def get_weather():
    tts.operation('getting weather')
    response = weather_helper.get_report()
    tts.operation(response)
Exemplo n.º 8
0
def search_wiki(input_text):
    tts.operation('searching')
    response = wiki_helper.search(input_text)
    print(response)
    tts.operation(response)
Exemplo n.º 9
0
def set_alarm(hours, minutes, ap):
    response = alarm_helper.create(hours, minutes, ap)
    tts.operation(response)
Exemplo n.º 10
0
def relay_operation(l_name, state):
    response = relay_helper.toggle(l_name, state)
    tts.operation(response)
Exemplo n.º 11
0
def what_is_time():
    text = time_tell.tell()
    tts.operation(text)
Exemplo n.º 12
0
def who_are_you():
    text = introduce.intro()
    tts.operation(text)