From b48907cafea945e970380528df02a5ed0999170f Mon Sep 17 00:00:00 2001 From: "B.Jothin kumar" Date: Mon, 4 Oct 2021 07:29:33 +0530 Subject: [PATCH 1/6] Update Jarvis2.py --- Jarvis2.py | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/Jarvis2.py b/Jarvis2.py index 95fc876..dcd3bed 100644 --- a/Jarvis2.py +++ b/Jarvis2.py @@ -15,6 +15,25 @@ MASTER = "Harsha" engine = pyttsx3.init('nsss') voices = engine.getProperty('voices') engine.setProperty('voice', voices[0].id) +popular_websites = {'google': 'https://www.google.com', + 'youtube': 'https://www.youtube.com', + 'wikipedia': 'https://www.wikipedia.org', + 'amazon': 'https://www.amazon.com'} +search_engines = {'google': 'https://www.google.com', + 'youtube': 'https://www.youtube.com', + 'bing': 'https://www.bing.com'} + + +def open_url(url): + webbrowser.open(url) + chrome_path = 'open -a /Applications/Google\ Chrome.app %s' + webbrowser.get(chrome_path).open(url) + +def search(search_query, search_engine): + try: + open_url(f'{search_engines[search_engine]}/search?q={search_query}') + except IndexError: + open_url(f'https://www.google.com/search?q={search_query}') def speak(text): @@ -80,21 +99,19 @@ elif "what\'s up" in query or 'how are you' in query: 'Nice!', 'I am nice and full of energy'] speak(random.choice(stMsgs)) -elif 'open youtube' in query.lower(): +elif 'open' in query.lower(): + website = query.replace('open', '').strip().lower() + try: + open_url(popular_websites[website]) + except IndexError: # If the website is unknown + print(f'Unknown website: {website}') + speak(f'Sorry, i don\'t know the website {website}') - webbrowser.open("youtube.com") - url = 'https://www.youtube.com/' +elif 'search' in query.lower(): + search_query = query.split('for')[-1] + search_engine = query.split('for')[0].replace('search', '').strip().lower() + search(search_query, search_engine) - chrome_path = 'open -a /Applications/Google\ Chrome.app %s' - webbrowser.get(chrome_path).open(url) - -elif 'on google' in query.lower(): - - webbrowser.open("google.com") - url = 'https://www.google.com/' - - chrome_path = 'open -a /Applications/Google\ Chrome.app %s' - webbrowser.get(chrome_path).open(url) elif 'email' in query: speak('Who is the recipient? ') From 12d4d78660dfecf054157ccf628025430f1b812d Mon Sep 17 00:00:00 2001 From: "B.Jothin kumar" Date: Mon, 4 Oct 2021 07:30:23 +0530 Subject: [PATCH 2/6] Update Jarvis2_4windows.py --- Jarvis2_4windows.py | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/Jarvis2_4windows.py b/Jarvis2_4windows.py index 83cd502..2435c33 100644 --- a/Jarvis2_4windows.py +++ b/Jarvis2_4windows.py @@ -16,6 +16,25 @@ MASTER = "Tony Stark" engine = pyttsx3.init('sapi5') # voices = engine.getProperty('voices') engine.setProperty('voice', voices[0].id) +popular_websites = {'google': 'https://www.google.com', + 'youtube': 'https://www.youtube.com', + 'wikipedia': 'https://www.wikipedia.org', + 'amazon': 'https://www.amazon.com'} +search_engines = {'google': 'https://www.google.com', + 'youtube': 'https://www.youtube.com', + 'bing': 'https://www.bing.com'} + + +def open_url(url): + webbrowser.open(url) + chrome_path = 'open -a /Applications/Google\ Chrome.app %s' + webbrowser.get(chrome_path).open(url) + +def search(search_query, search_engine): + try: + open_url(f'{search_engines[search_engine]}/search?q={search_query}') + except IndexError: + open_url(f'https://www.google.com/search?q={search_query}') def speak(text): @@ -81,21 +100,18 @@ while True: 'Nice!', 'I am nice and full of energy'] speak(random.choice(stMsgs)) - elif 'open_youtube' in query.lower() or 'youtube' in query.lower(): + elif 'open' in query.lower(): + website = query.replace('open', '').strip().lower() + try: + open_url(popular_websites[website]) + except IndexError: # If the website is unknown + print(f'Unknown website: {website}') + speak(f'Sorry, i don\'t know the website {website}') - webbrowser.open("youtube.com") - url = 'https://www.youtube.com/' - - chrome_path = 'open -a /Applications/Google/ Chrome.app %s' - webbrowser.get(chrome_path).open(url) - - elif 'open_google' in query.lower() or 'google' in query.lower(): - - webbrowser.open("google.com") - url = 'https://www.google.com/' - - chrome_path = 'open -a /Applications/Google/ Chrome.app %s' - webbrowser.get(chrome_path).open(url) + elif 'search' in query.lower(): + search_query = query.split('for')[-1] + search_engine = query.split('for')[0].replace('search', '').strip().lower() + search(search_query, search_engine) elif 'mail' in query: speak('Who is the recipient? ') From c216932520f57f100b30e3e3b3082b55bc070180 Mon Sep 17 00:00:00 2001 From: "B.Jothin kumar" Date: Mon, 4 Oct 2021 07:50:21 +0530 Subject: [PATCH 3/6] Update Jarvis2.py --- Jarvis2.py | 43 +++++++++++++------------------------------ 1 file changed, 13 insertions(+), 30 deletions(-) diff --git a/Jarvis2.py b/Jarvis2.py index dcd3bed..95fc876 100644 --- a/Jarvis2.py +++ b/Jarvis2.py @@ -15,25 +15,6 @@ MASTER = "Harsha" engine = pyttsx3.init('nsss') voices = engine.getProperty('voices') engine.setProperty('voice', voices[0].id) -popular_websites = {'google': 'https://www.google.com', - 'youtube': 'https://www.youtube.com', - 'wikipedia': 'https://www.wikipedia.org', - 'amazon': 'https://www.amazon.com'} -search_engines = {'google': 'https://www.google.com', - 'youtube': 'https://www.youtube.com', - 'bing': 'https://www.bing.com'} - - -def open_url(url): - webbrowser.open(url) - chrome_path = 'open -a /Applications/Google\ Chrome.app %s' - webbrowser.get(chrome_path).open(url) - -def search(search_query, search_engine): - try: - open_url(f'{search_engines[search_engine]}/search?q={search_query}') - except IndexError: - open_url(f'https://www.google.com/search?q={search_query}') def speak(text): @@ -99,19 +80,21 @@ elif "what\'s up" in query or 'how are you' in query: 'Nice!', 'I am nice and full of energy'] speak(random.choice(stMsgs)) -elif 'open' in query.lower(): - website = query.replace('open', '').strip().lower() - try: - open_url(popular_websites[website]) - except IndexError: # If the website is unknown - print(f'Unknown website: {website}') - speak(f'Sorry, i don\'t know the website {website}') +elif 'open youtube' in query.lower(): -elif 'search' in query.lower(): - search_query = query.split('for')[-1] - search_engine = query.split('for')[0].replace('search', '').strip().lower() - search(search_query, search_engine) + webbrowser.open("youtube.com") + url = 'https://www.youtube.com/' + chrome_path = 'open -a /Applications/Google\ Chrome.app %s' + webbrowser.get(chrome_path).open(url) + +elif 'on google' in query.lower(): + + webbrowser.open("google.com") + url = 'https://www.google.com/' + + chrome_path = 'open -a /Applications/Google\ Chrome.app %s' + webbrowser.get(chrome_path).open(url) elif 'email' in query: speak('Who is the recipient? ') From 7348f4e23c8bf7a7d9868523be96603408e1e671 Mon Sep 17 00:00:00 2001 From: "B.Jothin kumar" Date: Mon, 4 Oct 2021 07:52:10 +0530 Subject: [PATCH 4/6] Update Jarvis2_4windows.py --- Jarvis2_4windows.py | 44 ++++++++++++++------------------------------ 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/Jarvis2_4windows.py b/Jarvis2_4windows.py index 2435c33..83cd502 100644 --- a/Jarvis2_4windows.py +++ b/Jarvis2_4windows.py @@ -16,25 +16,6 @@ MASTER = "Tony Stark" engine = pyttsx3.init('sapi5') # voices = engine.getProperty('voices') engine.setProperty('voice', voices[0].id) -popular_websites = {'google': 'https://www.google.com', - 'youtube': 'https://www.youtube.com', - 'wikipedia': 'https://www.wikipedia.org', - 'amazon': 'https://www.amazon.com'} -search_engines = {'google': 'https://www.google.com', - 'youtube': 'https://www.youtube.com', - 'bing': 'https://www.bing.com'} - - -def open_url(url): - webbrowser.open(url) - chrome_path = 'open -a /Applications/Google\ Chrome.app %s' - webbrowser.get(chrome_path).open(url) - -def search(search_query, search_engine): - try: - open_url(f'{search_engines[search_engine]}/search?q={search_query}') - except IndexError: - open_url(f'https://www.google.com/search?q={search_query}') def speak(text): @@ -100,18 +81,21 @@ while True: 'Nice!', 'I am nice and full of energy'] speak(random.choice(stMsgs)) - elif 'open' in query.lower(): - website = query.replace('open', '').strip().lower() - try: - open_url(popular_websites[website]) - except IndexError: # If the website is unknown - print(f'Unknown website: {website}') - speak(f'Sorry, i don\'t know the website {website}') + elif 'open_youtube' in query.lower() or 'youtube' in query.lower(): - elif 'search' in query.lower(): - search_query = query.split('for')[-1] - search_engine = query.split('for')[0].replace('search', '').strip().lower() - search(search_query, search_engine) + webbrowser.open("youtube.com") + url = 'https://www.youtube.com/' + + chrome_path = 'open -a /Applications/Google/ Chrome.app %s' + webbrowser.get(chrome_path).open(url) + + elif 'open_google' in query.lower() or 'google' in query.lower(): + + webbrowser.open("google.com") + url = 'https://www.google.com/' + + chrome_path = 'open -a /Applications/Google/ Chrome.app %s' + webbrowser.get(chrome_path).open(url) elif 'mail' in query: speak('Who is the recipient? ') From c8b8dd7d4e9a55fa7bb38d682930073815a64e4f Mon Sep 17 00:00:00 2001 From: "B.Jothin kumar" Date: Mon, 4 Oct 2021 07:55:30 +0530 Subject: [PATCH 5/6] Update Jarvis2.py --- Jarvis2.py | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/Jarvis2.py b/Jarvis2.py index 95fc876..dcd3bed 100644 --- a/Jarvis2.py +++ b/Jarvis2.py @@ -15,6 +15,25 @@ MASTER = "Harsha" engine = pyttsx3.init('nsss') voices = engine.getProperty('voices') engine.setProperty('voice', voices[0].id) +popular_websites = {'google': 'https://www.google.com', + 'youtube': 'https://www.youtube.com', + 'wikipedia': 'https://www.wikipedia.org', + 'amazon': 'https://www.amazon.com'} +search_engines = {'google': 'https://www.google.com', + 'youtube': 'https://www.youtube.com', + 'bing': 'https://www.bing.com'} + + +def open_url(url): + webbrowser.open(url) + chrome_path = 'open -a /Applications/Google\ Chrome.app %s' + webbrowser.get(chrome_path).open(url) + +def search(search_query, search_engine): + try: + open_url(f'{search_engines[search_engine]}/search?q={search_query}') + except IndexError: + open_url(f'https://www.google.com/search?q={search_query}') def speak(text): @@ -80,21 +99,19 @@ elif "what\'s up" in query or 'how are you' in query: 'Nice!', 'I am nice and full of energy'] speak(random.choice(stMsgs)) -elif 'open youtube' in query.lower(): +elif 'open' in query.lower(): + website = query.replace('open', '').strip().lower() + try: + open_url(popular_websites[website]) + except IndexError: # If the website is unknown + print(f'Unknown website: {website}') + speak(f'Sorry, i don\'t know the website {website}') - webbrowser.open("youtube.com") - url = 'https://www.youtube.com/' +elif 'search' in query.lower(): + search_query = query.split('for')[-1] + search_engine = query.split('for')[0].replace('search', '').strip().lower() + search(search_query, search_engine) - chrome_path = 'open -a /Applications/Google\ Chrome.app %s' - webbrowser.get(chrome_path).open(url) - -elif 'on google' in query.lower(): - - webbrowser.open("google.com") - url = 'https://www.google.com/' - - chrome_path = 'open -a /Applications/Google\ Chrome.app %s' - webbrowser.get(chrome_path).open(url) elif 'email' in query: speak('Who is the recipient? ') From df8374ca3d97969b71592736ca4159ee4c3b1122 Mon Sep 17 00:00:00 2001 From: "B.Jothin kumar" Date: Mon, 4 Oct 2021 07:56:18 +0530 Subject: [PATCH 6/6] Update Jarvis2_4windows.py --- Jarvis2_4windows.py | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/Jarvis2_4windows.py b/Jarvis2_4windows.py index 83cd502..2435c33 100644 --- a/Jarvis2_4windows.py +++ b/Jarvis2_4windows.py @@ -16,6 +16,25 @@ MASTER = "Tony Stark" engine = pyttsx3.init('sapi5') # voices = engine.getProperty('voices') engine.setProperty('voice', voices[0].id) +popular_websites = {'google': 'https://www.google.com', + 'youtube': 'https://www.youtube.com', + 'wikipedia': 'https://www.wikipedia.org', + 'amazon': 'https://www.amazon.com'} +search_engines = {'google': 'https://www.google.com', + 'youtube': 'https://www.youtube.com', + 'bing': 'https://www.bing.com'} + + +def open_url(url): + webbrowser.open(url) + chrome_path = 'open -a /Applications/Google\ Chrome.app %s' + webbrowser.get(chrome_path).open(url) + +def search(search_query, search_engine): + try: + open_url(f'{search_engines[search_engine]}/search?q={search_query}') + except IndexError: + open_url(f'https://www.google.com/search?q={search_query}') def speak(text): @@ -81,21 +100,18 @@ while True: 'Nice!', 'I am nice and full of energy'] speak(random.choice(stMsgs)) - elif 'open_youtube' in query.lower() or 'youtube' in query.lower(): + elif 'open' in query.lower(): + website = query.replace('open', '').strip().lower() + try: + open_url(popular_websites[website]) + except IndexError: # If the website is unknown + print(f'Unknown website: {website}') + speak(f'Sorry, i don\'t know the website {website}') - webbrowser.open("youtube.com") - url = 'https://www.youtube.com/' - - chrome_path = 'open -a /Applications/Google/ Chrome.app %s' - webbrowser.get(chrome_path).open(url) - - elif 'open_google' in query.lower() or 'google' in query.lower(): - - webbrowser.open("google.com") - url = 'https://www.google.com/' - - chrome_path = 'open -a /Applications/Google/ Chrome.app %s' - webbrowser.get(chrome_path).open(url) + elif 'search' in query.lower(): + search_query = query.split('for')[-1] + search_engine = query.split('for')[0].replace('search', '').strip().lower() + search(search_query, search_engine) elif 'mail' in query: speak('Who is the recipient? ')