diff --git a/Jarvis2_4windows.py b/Jarvis2_4windows.py index 436b23f..845fc80 100644 --- a/Jarvis2_4windows.py +++ b/Jarvis2_4windows.py @@ -3,7 +3,7 @@ import os import speech_recognition as sr -from actions import search_engine_selector, speak, wishMe +from actions import search_engine_selector, speak, wish_me from commands import ( command_bye, command_hello, @@ -24,13 +24,13 @@ popular_websites = { "youtube": "https://www.youtube.com", "wikipedia": "https://www.wikipedia.org", "amazon": "https://www.amazon.com", - "GitHub": "https://www.github.com", + "github": "https://www.github.com", } -def main(search_engine, takeCommand, debug): +def main(search_engine, take_command, debug): while True: - query = takeCommand().lower() + query = take_command().lower() # logic for executing commands without arguments phrases = { @@ -59,14 +59,14 @@ def main(search_engine, takeCommand, debug): popular_websites, debug, search_engine, - takeCommand + take_command ) elif "search" in query.lower(): command_search(query, search_engine) elif "mail" in query: - command_mail(takeCommand) + command_mail(take_command) speak("Next Command! Sir!") @@ -79,11 +79,10 @@ def run(): debug = config['DEFAULT']['debug'] if debug == "True": - def takeCommand(): - query = input("Command |--> ") - return query + def take_command(): + return input("Command |--> ") else: - def takeCommand(): + def take_command(): r = sr.Recognizer() with sr.Microphone() as source: print("Listening....") @@ -109,13 +108,12 @@ def run(): print("Say That Again Please") else: pass - query = None - return query + return None speak(text="Initializing Jarvis....") - wishMe(master) - main(search_engine, takeCommand, debug) + wish_me(master) + main(search_engine, take_command, debug) if os.path.isfile('./config.ini'): # Checks if config.ini exists. diff --git a/__pycache__/actions.cpython-37.pyc b/__pycache__/actions.cpython-37.pyc index 86bdcf1..007000d 100644 Binary files a/__pycache__/actions.cpython-37.pyc and b/__pycache__/actions.cpython-37.pyc differ diff --git a/__pycache__/commands.cpython-37.pyc b/__pycache__/commands.cpython-37.pyc index f2dd312..1f8d27a 100644 Binary files a/__pycache__/commands.cpython-37.pyc and b/__pycache__/commands.cpython-37.pyc differ diff --git a/actions.py b/actions.py index 1d86ace..965b5cd 100644 --- a/actions.py +++ b/actions.py @@ -50,7 +50,7 @@ def speak(text): engine.runAndWait() -def wishMe(master): +def wish_me(master): hour = datetime.datetime.now().hour # print(hour) if hour >= 0 and hour < 12: diff --git a/commands.py b/commands.py index 575fc16..c930b71 100644 --- a/commands.py +++ b/commands.py @@ -24,16 +24,16 @@ def command_wikipedia(debug, query): def command_whatsup(): - stMsgs = [ + st_msgs = [ "Just doing my thing!", "I am fine!", "Nice!", "I am nice and full of energy", ] - speak(random.choice(stMsgs)) + speak(random.choice(st_msgs)) -def command_open(query, popular_websites, debug, search_engine, takeCommand): +def command_open(query, popular_websites, debug, search_engine, take_command): website = query.replace("open", "").strip().lower() try: open_url(popular_websites[website]) @@ -44,7 +44,7 @@ def command_open(query, popular_websites, debug, search_engine, takeCommand): pass speak(f"Sorry, i don't know the website {website}") speak(f"¿Do you want me to search {website} in the web?") - if takeCommand() == "yes": + if take_command() == "yes": search(website, search_engine) else: pass @@ -55,13 +55,13 @@ def command_search(query, search_engine): search(search_query, search_engine) -def command_mail(takeCommand): +def command_mail(take_command): speak("Who is the recipient? ") - recipient = takeCommand() + recipient = take_command() try: speak("What should I say? ") - content = takeCommand() + content = take_command() email = config['EMAIL'] server = smtplib.SMTP(email['server'], email['port']) diff --git a/config.ini b/config.ini index a429e48..3b76e46 100644 --- a/config.ini +++ b/config.ini @@ -2,7 +2,7 @@ master = YourName search_engine = Google #Google/Bing/DuckDuckGo/Youtube -debug = False +debug = True #True/False musicPath = [EMAIL]