From 3350726592cd4fdd465e5c558c450a964ce694bb Mon Sep 17 00:00:00 2001 From: TallGorilla <24dasemu@gmail.com> Date: Fri, 8 Oct 2021 18:53:12 +0200 Subject: [PATCH] fixed everything again --- Jarvis2_4windows.py | 26 ++++++++++++-------------- __pycache__/actions.cpython-37.pyc | Bin 1709 -> 1710 bytes __pycache__/commands.cpython-37.pyc | Bin 3418 -> 3420 bytes actions.py | 2 +- commands.py | 14 +++++++------- config.ini | 2 +- 6 files changed, 21 insertions(+), 23 deletions(-) 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 86bdcf1e1198310a911be0fdb98f2824d115358a..007000dcf2513c8289a04bd835c4150bc92fb26b 100644 GIT binary patch delta 61 zcmZ3>yN;LFiIlS-?W^qP*?&L45 FI{~u|4~PH& delta 60 zcmZ3-yOx*NiI= 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]