fixed everything
This commit is contained in:
parent
3333780e1e
commit
6f5fece60e
11
Jarvis2.py
11
Jarvis2.py
@ -13,7 +13,7 @@ import speech_recognition as sr
|
|||||||
import wikipedia
|
import wikipedia
|
||||||
|
|
||||||
print("Initializing Jarvis....")
|
print("Initializing Jarvis....")
|
||||||
MASTER = getpass.getuser()
|
master = getpass.getuser()
|
||||||
|
|
||||||
engine = pyttsx3.init("nsss")
|
engine = pyttsx3.init("nsss")
|
||||||
voices = engine.getProperty("voices")
|
voices = engine.getProperty("voices")
|
||||||
@ -58,11 +58,11 @@ def print_and_speak(text):
|
|||||||
def wish_me():
|
def wish_me():
|
||||||
hour = datetime.datetime.now().hour
|
hour = datetime.datetime.now().hour
|
||||||
if hour < 12:
|
if hour < 12:
|
||||||
speak("Good Morning" + MASTER)
|
speak("Good Morning" + master)
|
||||||
elif hour < 18:
|
elif hour < 18:
|
||||||
speak("Good Afternoon" + MASTER)
|
speak("Good Afternoon" + master)
|
||||||
else:
|
else:
|
||||||
speak("Good Evening" + MASTER)
|
speak("Good Evening" + master)
|
||||||
|
|
||||||
# speak("Hey I am Jarvis. How may I help you")
|
# speak("Hey I am Jarvis. How may I help you")
|
||||||
|
|
||||||
@ -148,7 +148,8 @@ elif "email" in query:
|
|||||||
server.close()
|
server.close()
|
||||||
speak("Email sent!")
|
speak("Email sent!")
|
||||||
except Exception:
|
except Exception:
|
||||||
speak("Sorry Sir! I am unable to send your message at this moment!")
|
speak("Sorry Sir!")
|
||||||
|
speak("I am unable to send your message at this moment!")
|
||||||
|
|
||||||
elif "nothing" in query or "abort" in query or "stop" in query:
|
elif "nothing" in query or "abort" in query or "stop" in query:
|
||||||
speak("okay")
|
speak("okay")
|
||||||
|
|||||||
@ -72,7 +72,7 @@ def main(search_engine, takeCommand, debug):
|
|||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
MASTER = config['DEFAULT']['MASTER']
|
master = config['DEFAULT']['MASTER']
|
||||||
|
|
||||||
search_engine = search_engine_selector(config)
|
search_engine = search_engine_selector(config)
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ def run():
|
|||||||
return query
|
return query
|
||||||
|
|
||||||
speak(text="Initializing Jarvis....")
|
speak(text="Initializing Jarvis....")
|
||||||
wishMe(MASTER)
|
wishMe(master)
|
||||||
main(search_engine, takeCommand, debug)
|
main(search_engine, takeCommand, debug)
|
||||||
|
|
||||||
|
|
||||||
@ -126,4 +126,3 @@ else:
|
|||||||
# if it doesn't exist it drops an error message and exits.
|
# if it doesn't exist it drops an error message and exits.
|
||||||
print('You need a config.ini file.')
|
print('You need a config.ini file.')
|
||||||
print('Check the documentation in the Github Repository.')
|
print('Check the documentation in the Github Repository.')
|
||||||
|
|
||||||
|
|||||||
@ -50,16 +50,16 @@ def speak(text):
|
|||||||
engine.runAndWait()
|
engine.runAndWait()
|
||||||
|
|
||||||
|
|
||||||
def wishMe(MASTER):
|
def wishMe(master):
|
||||||
hour = datetime.datetime.now().hour
|
hour = datetime.datetime.now().hour
|
||||||
# print(hour)
|
# print(hour)
|
||||||
if hour >= 0 and hour < 12:
|
if hour >= 0 and hour < 12:
|
||||||
speak("Good Morning" + MASTER)
|
speak("Good Morning" + master)
|
||||||
|
|
||||||
elif hour >= 12 and hour < 18:
|
elif hour >= 12 and hour < 18:
|
||||||
speak("Good Afternoon" + MASTER)
|
speak("Good Afternoon" + master)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
speak("Good Evening" + MASTER)
|
speak("Good Evening" + master)
|
||||||
|
|
||||||
# speak("Hey I am Jarvis. How may I help you")
|
# speak("Hey I am Jarvis. How may I help you")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user