Added Readme and updated Assistant
This commit is contained in:
parent
e54738e725
commit
3aaaee5702
54
Jarvis2.py
54
Jarvis2.py
@ -5,6 +5,8 @@ import wikipedia
|
|||||||
import webbrowser
|
import webbrowser
|
||||||
import os
|
import os
|
||||||
import smtplib
|
import smtplib
|
||||||
|
import sys
|
||||||
|
import random
|
||||||
|
|
||||||
print("Initializing Jarvis....")
|
print("Initializing Jarvis....")
|
||||||
MASTER = "Harsha"
|
MASTER = "Harsha"
|
||||||
@ -14,12 +16,12 @@ engine = pyttsx3.init('nsss')
|
|||||||
voices = engine.getProperty('voices')
|
voices = engine.getProperty('voices')
|
||||||
engine.setProperty('voice', voices[0].id)
|
engine.setProperty('voice', voices[0].id)
|
||||||
|
|
||||||
|
|
||||||
def speak(text):
|
def speak(text):
|
||||||
engine.say(text)
|
engine.say(text)
|
||||||
engine.runAndWait()
|
engine.runAndWait()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def wishMe():
|
def wishMe():
|
||||||
hour = datetime.datetime.now().hour
|
hour = datetime.datetime.now().hour
|
||||||
# print(hour)
|
# print(hour)
|
||||||
@ -73,6 +75,10 @@ if 'wikipedia' in query.lower():
|
|||||||
print(results)
|
print(results)
|
||||||
speak(results)
|
speak(results)
|
||||||
|
|
||||||
|
elif "what\'s up" in query or 'how are you' in query:
|
||||||
|
stMsgs = ['Just doing my thing!', 'I am fine!',
|
||||||
|
'Nice!', 'I am nice and full of energy']
|
||||||
|
speak(random.choice(stMsgs))
|
||||||
|
|
||||||
elif 'open youtube' in query.lower():
|
elif 'open youtube' in query.lower():
|
||||||
|
|
||||||
@ -90,8 +96,44 @@ elif 'on google' in query.lower():
|
|||||||
chrome_path = 'open -a /Applications/Google\ Chrome.app %s'
|
chrome_path = 'open -a /Applications/Google\ Chrome.app %s'
|
||||||
webbrowser.get(chrome_path).open(url)
|
webbrowser.get(chrome_path).open(url)
|
||||||
|
|
||||||
# elif 'play music' in query.lower():
|
elif 'email' in query:
|
||||||
# songs_dir = "//Users//bindu//Desktop//imusic"
|
speak('Who is the recipient? ')
|
||||||
# songs = os.listdir(songs_dir)
|
recipient = takeCommand()
|
||||||
# print(songs)
|
|
||||||
# os.open(os.path.join(songs_dir, songs[0]))
|
if 'me' in recipient:
|
||||||
|
try:
|
||||||
|
speak('What should I say? ')
|
||||||
|
content = takeCommand()
|
||||||
|
|
||||||
|
server = smtplib.SMTP('smtp.gmail.com', 587)
|
||||||
|
server.ehlo()
|
||||||
|
server.starttls()
|
||||||
|
server.login("Your_Username", 'Your_Password')
|
||||||
|
server.sendmail('Your_Username', "Recipient_Username", content)
|
||||||
|
server.close()
|
||||||
|
speak('Email sent!')
|
||||||
|
|
||||||
|
except:
|
||||||
|
speak('Sorry Sir! I am unable to send your message at this moment!')
|
||||||
|
|
||||||
|
elif 'nothing' in query or 'abort' in query or 'stop' in query:
|
||||||
|
speak('okay')
|
||||||
|
speak('Bye Sir, have a good day.')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
elif 'hello' in query:
|
||||||
|
speak('Hello Sir')
|
||||||
|
|
||||||
|
elif 'bye' in query:
|
||||||
|
speak('Bye Sir, have a good day.')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
elif 'play music' in query:
|
||||||
|
music_folder = Your_music_folder_path
|
||||||
|
music = [music1, music2, music3, music4, music5]
|
||||||
|
random_music = music_folder + random.choice(music) + '.mp3'
|
||||||
|
os.system(random_music)
|
||||||
|
|
||||||
|
speak('Playing your request')
|
||||||
|
|
||||||
|
speak('Next Command! Sir!')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user