-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
39 lines (34 loc) · 1.82 KB
/
app.py
File metadata and controls
39 lines (34 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import voice as voice
import search as search
import random
import datetime
def say_quote():
quotes = ['I never wanted you to come back to Gotham. I always knew there was nothing for you here, except pain and tragedy. And I wanted something more for you than that. I still do.', 'We burned the forest down.', 'Endure, Mister Wayne. Take it. They will hate you for it, but that is the point of the Batman. He can be the outcast, he can make the choice that no one else can make, the right choice.', 'Some men just want to watch the world burn.', 'I have sewn you up, I have set your bones, but I will not bury you. I have buried enough members of the Wayne family.', 'He is not being a hero. He is being something more.', 'I am so sorry. I failed you. You trusted me and I failed you', 'Rachel believed in what you stood for, what we stand for. Gotham needs you.']
quote_nr = random.randrange(7)
voice.system_say(quotes[quote_nr])
def say_time():
time = datetime.datetime.now()
time_tuple = time.timetuple()
time_string = '' + str(time_tuple.tm_hour) + ' hours and ' + str(time_tuple.tm_min) + ' minutes'
voice.system_say(time_string)
def get_requests():
voice.system_say("How can I help you, Sir?")
exit_keywords = ['goodbye', 'bye', 'later', 'exit', 'close']
time_keywords = ['time', 'what time is it', 'tell me the time']
quotes_keywords = ['quotes', 'phrases']
search_keyword = 'search '
request = voice.audio_recognition()
while(request.lower() not in exit_keywords):
if request.lower() in quotes_keywords:
say_quote()
if search_keyword in request.lower():
full_text = request.split(search_keyword)
search_text = full_text[1]
search.wikipedia_search(search_text)
if request.lower() in time_keywords:
say_time()
request = voice.audio_recognition()
#print(request)
if __name__ == '__main__':
#say_time()
get_requests()