├── .gitignore ├── CONTRIBUTING.md ├── Jarvis ├── __init__.py ├── config │ └── config.py ├── features │ ├── __init__.py │ ├── date_time.py │ ├── google_calendar.py │ ├── google_search.py │ ├── gui.py │ ├── launch_app.py │ ├── loc.py │ ├── news.py │ ├── note.py │ ├── send_email.py │ ├── system_stats.py │ ├── weather.py │ ├── website_open.py │ ├── wikipedia.py │ └── youtube_search.py └── utils │ └── images │ ├── initiating.gif │ ├── live_wallpaper.gif │ ├── loading.gif │ ├── loading_1.gif │ └── program_load.gif ├── LICENSE ├── README.md ├── driver └── chromedriver.exe ├── gui.ui ├── main.py └── requirements.txt /.gitignore: -------------------------------------------------------------------------------- 1 | References/ 2 | env/ 3 | .vscode/ 4 | __pycache__/ 5 | experiments/ 6 | *.log 7 | config.py 8 | *.pickle 9 | credentials.json 10 | *note.txt 11 | *.png 12 | *.mp4 13 | *dbs.txt -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via issue, 4 | email, or any other method with the owners of this repository before making a change. 5 | 6 | Please note we have a code of conduct, please follow it in all your interactions with the project. 7 | 8 | ## Pull Request Process 9 | 10 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a 11 | build. 12 | 2. Update the README.md with details of changes to the interface, this includes new environment 13 | variables, exposed ports, useful file locations and container parameters. 14 | 3. Increase the version numbers in any examples files and the README.md to the new version that this 15 | Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/). 16 | 4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you 17 | do not have permission to do that, you may request the second reviewer to merge it for you. 18 | 19 | ## Code of Conduct 20 | 21 | ### Our Pledge 22 | 23 | In the interest of fostering an open and welcoming environment, we as 24 | contributors and maintainers pledge to making participation in our project and 25 | our community a harassment-free experience for everyone, regardless of age, body 26 | size, disability, ethnicity, gender identity and expression, level of experience, 27 | nationality, personal appearance, race, religion, or sexual identity and 28 | orientation. 29 | 30 | ### Our Standards 31 | 32 | Examples of behavior that contributes to creating a positive environment 33 | include: 34 | 35 | * Using welcoming and inclusive language 36 | * Being respectful of differing viewpoints and experiences 37 | * Gracefully accepting constructive criticism 38 | * Focusing on what is best for the community 39 | * Showing empathy towards other community members 40 | 41 | Examples of unacceptable behavior by participants include: 42 | 43 | * The use of sexualized language or imagery and unwelcome sexual attention or 44 | advances 45 | * Trolling, insulting/derogatory comments, and personal or political attacks 46 | * Public or private harassment 47 | * Publishing others' private information, such as a physical or electronic 48 | address, without explicit permission 49 | * Other conduct which could reasonably be considered inappropriate in a 50 | professional setting 51 | 52 | ### Our Responsibilities 53 | 54 | Project maintainers are responsible for clarifying the standards of acceptable 55 | behavior and are expected to take appropriate and fair corrective action in 56 | response to any instances of unacceptable behavior. 57 | 58 | Project maintainers have the right and responsibility to remove, edit, or 59 | reject comments, commits, code, wiki edits, issues, and other contributions 60 | that are not aligned to this Code of Conduct, or to ban temporarily or 61 | permanently any contributor for other behaviors that they deem inappropriate, 62 | threatening, offensive, or harmful. 63 | 64 | ### Scope 65 | 66 | This Code of Conduct applies both within project spaces and in public spaces 67 | when an individual is representing the project or its community. Examples of 68 | representing a project or community include using an official project e-mail 69 | address, posting via an official social media account, or acting as an appointed 70 | representative at an online or offline event. Representation of a project may be 71 | further defined and clarified by project maintainers. 72 | 73 | ### Enforcement 74 | 75 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 76 | reported by contacting the project team at [INSERT EMAIL ADDRESS]. All 77 | complaints will be reviewed and investigated and will result in a response that 78 | is deemed necessary and appropriate to the circumstances. The project team is 79 | obligated to maintain confidentiality with regard to the reporter of an incident. 80 | Further details of specific enforcement policies may be posted separately. 81 | 82 | Project maintainers who do not follow or enforce the Code of Conduct in good 83 | faith may face temporary or permanent repercussions as determined by other 84 | members of the project's leadership. 85 | 86 | ### Attribution 87 | 88 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 89 | available at [http://contributor-covenant.org/version/1/4][version] 90 | 91 | [homepage]: http://contributor-covenant.org 92 | [version]: http://contributor-covenant.org/version/1/4/ -------------------------------------------------------------------------------- /Jarvis/__init__.py: -------------------------------------------------------------------------------- 1 | import speech_recognition as sr 2 | import pyttsx3 3 | 4 | from Jarvis.features import date_time 5 | from Jarvis.features import launch_app 6 | from Jarvis.features import website_open 7 | from Jarvis.features import weather 8 | from Jarvis.features import wikipedia 9 | from Jarvis.features import news 10 | from Jarvis.features import send_email 11 | from Jarvis.features import google_search 12 | from Jarvis.features import google_calendar 13 | from Jarvis.features import note 14 | from Jarvis.features import system_stats 15 | from Jarvis.features import loc 16 | 17 | 18 | engine = pyttsx3.init('sapi5') 19 | voices = engine.getProperty('voices') 20 | engine.setProperty('voices', voices[0].id) 21 | 22 | class JarvisAssistant: 23 | def __init__(self): 24 | pass 25 | 26 | def mic_input(self): 27 | """ 28 | Fetch input from mic 29 | return: user's voice input as text if true, false if fail 30 | """ 31 | try: 32 | r = sr.Recognizer() 33 | # r.pause_threshold = 1 34 | # r.adjust_for_ambient_noise(source, duration=1) 35 | with sr.Microphone() as source: 36 | print("Listening....") 37 | r.energy_threshold = 4000 38 | audio = r.listen(source) 39 | try: 40 | print("Recognizing...") 41 | command = r.recognize_google(audio, language='en-in').lower() 42 | print(f'You said: {command}') 43 | except: 44 | print('Please try again') 45 | command = self.mic_input() 46 | return command 47 | except Exception as e: 48 | print(e) 49 | return False 50 | 51 | 52 | def tts(self, text): 53 | """ 54 | Convert any text to speech 55 | :param text: text(String) 56 | :return: True/False (Play sound if True otherwise write exception to log and return False) 57 | """ 58 | try: 59 | engine.say(text) 60 | engine.runAndWait() 61 | engine.setProperty('rate', 175) 62 | return True 63 | except: 64 | t = "Sorry I couldn't understand and handle this input" 65 | print(t) 66 | return False 67 | 68 | def tell_me_date(self): 69 | 70 | return date_time.date() 71 | 72 | def tell_time(self): 73 | 74 | return date_time.time() 75 | 76 | def launch_any_app(self, path_of_app): 77 | """ 78 | Launch any windows application 79 | :param path_of_app: path of exe 80 | :return: True is success and open the application, False if fail 81 | """ 82 | return launch_app.launch_app(path_of_app) 83 | 84 | def website_opener(self, domain): 85 | """ 86 | This will open website according to domain 87 | :param domain: any domain, example "youtube.com" 88 | :return: True if success, False if fail 89 | """ 90 | return website_open.website_opener(domain) 91 | 92 | 93 | def weather(self, city): 94 | """ 95 | Return weather 96 | :param city: Any city of this world 97 | :return: weather info as string if True, or False 98 | """ 99 | try: 100 | res = weather.fetch_weather(city) 101 | except Exception as e: 102 | print(e) 103 | res = False 104 | return res 105 | 106 | def tell_me(self, topic): 107 | """ 108 | Tells about anything from wikipedia 109 | :param topic: any string is valid options 110 | :return: First 500 character from wikipedia if True, False if fail 111 | """ 112 | return wikipedia.tell_me_about(topic) 113 | 114 | def news(self): 115 | """ 116 | Fetch top news of the day from google news 117 | :return: news list of string if True, False if fail 118 | """ 119 | return news.get_news() 120 | 121 | def send_mail(self, sender_email, sender_password, receiver_email, msg): 122 | 123 | return send_email.mail(sender_email, sender_password, receiver_email, msg) 124 | 125 | def google_calendar_events(self, text): 126 | service = google_calendar.authenticate_google() 127 | date = google_calendar.get_date(text) 128 | 129 | if date: 130 | return google_calendar.get_events(date, service) 131 | else: 132 | pass 133 | 134 | def search_anything_google(self, command): 135 | google_search.google_search(command) 136 | 137 | def take_note(self, text): 138 | note.note(text) 139 | 140 | def system_info(self): 141 | return system_stats.system_stats() 142 | 143 | def location(self, location): 144 | current_loc, target_loc, distance = loc.loc(location) 145 | return current_loc, target_loc, distance 146 | 147 | def my_location(self): 148 | city, state, country = loc.my_location() 149 | return city, state, country -------------------------------------------------------------------------------- /Jarvis/config/config.py: -------------------------------------------------------------------------------- 1 | email = "" 2 | email_password = "" 3 | wolframalpha_id = "" 4 | -------------------------------------------------------------------------------- /Jarvis/features/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gladiator07/JARVIS/83aa2ee2b81d0aa9e8399c4ef599d992b6a3bf67/Jarvis/features/__init__.py -------------------------------------------------------------------------------- /Jarvis/features/date_time.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | 4 | def date(): 5 | """ 6 | Just return date as string 7 | :return: date if success, False if fail 8 | """ 9 | try: 10 | date = datetime.datetime.now().strftime("%b %d %Y") 11 | except Exception as e: 12 | print(e) 13 | date = False 14 | return date 15 | 16 | 17 | def time(): 18 | """ 19 | Just return time as string 20 | :return: time if success, False if fail 21 | """ 22 | try: 23 | time = datetime.datetime.now().strftime("%H:%M:%S") 24 | except Exception as e: 25 | print(e) 26 | time = False 27 | return time -------------------------------------------------------------------------------- /Jarvis/features/google_calendar.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | import datetime, pytz, pyttsx3, pickle, os.path 3 | from googleapiclient.discovery import build 4 | from google_auth_oauthlib.flow import InstalledAppFlow 5 | from google.auth.transport.requests import Request 6 | 7 | 8 | 9 | MONTHS = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"] 10 | DAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"] 11 | DAY_EXTENSIONS = ["rd", "th", "st", "nd"] 12 | 13 | 14 | 15 | 16 | 17 | def speak(text): 18 | engine = pyttsx3.init('sapi5') 19 | voices = engine.getProperty('voices') 20 | engine.setProperty('voices', voices[0].id) 21 | engine.say(text) 22 | engine.runAndWait() 23 | engine.setProperty('rate', 180) 24 | 25 | 26 | 27 | 28 | # If modifying these scopes, delete the file token.pickle. 29 | SCOPES = ['https://www.googleapis.com/auth/calendar.readonly'] 30 | 31 | 32 | def authenticate_google(): 33 | """Shows basic usage of the Google Calendar API. 34 | Prints the start and name of the next 10 events on the user's calendar. 35 | """ 36 | creds = None 37 | # The file token.pickle stores the user's access and refresh tokens, and is 38 | # created automatically when the authorization flow completes for the first 39 | # time. 40 | if os.path.exists('token.pickle'): 41 | with open('token.pickle', 'rb') as token: 42 | creds = pickle.load(token) 43 | # If there are no (valid) credentials available, let the user log in. 44 | if not creds or not creds.valid: 45 | if creds and creds.expired and creds.refresh_token: 46 | creds.refresh(Request()) 47 | else: 48 | flow = InstalledAppFlow.from_client_secrets_file( 49 | 'credentials.json', SCOPES) 50 | creds = flow.run_local_server(port=0) 51 | # Save the credentials for the next run 52 | with open('token.pickle', 'wb') as token: 53 | pickle.dump(creds, token) 54 | 55 | service = build('calendar', 'v3', credentials=creds) 56 | 57 | return service 58 | 59 | def get_events(day, service): 60 | # Call the Calendar API 61 | date = datetime.datetime.combine(day, datetime.datetime.min.time()) 62 | end_date = datetime.datetime.combine(day, datetime.datetime.max.time()) 63 | utc = pytz.UTC 64 | date = date.astimezone(utc) 65 | end_date = end_date.astimezone(utc) 66 | 67 | 68 | 69 | events_result = service.events().list(calendarId='primary', timeMin=date.isoformat(), timeMax=end_date.isoformat(), 70 | singleEvents=True, 71 | orderBy='startTime').execute() 72 | events = events_result.get('items', []) 73 | 74 | if not events: 75 | speak('No upcoming events found.') 76 | else: 77 | speak(f"You have {len(events)} events on this day.") 78 | 79 | for event in events: 80 | start = event['start'].get('dateTime', event['start'].get('date')) 81 | print(start, event['summary']) 82 | start_time = str(start.split("T")[1].split("+")[0]) # get the hour the event starts 83 | if int(start_time.split(":")[0]) < 12: # if the event is in the morning 84 | start_time = start_time + "am" 85 | else: 86 | start_time = str(int(start_time.split(":")[0])-12) # convert 24 hour time to regular 87 | start_time = start_time + "pm" 88 | 89 | speak(event["summary"] + " at " + start_time) 90 | 91 | 92 | def get_date(text): 93 | today = datetime.date.today() 94 | 95 | if text.count("today") > 0: 96 | return today 97 | 98 | day = -1 99 | day_of_week = -1 100 | month = -1 101 | year = today.year 102 | 103 | for word in text.split(): 104 | if word in MONTHS: 105 | month = MONTHS.index(word) + 1 106 | elif word in DAYS: 107 | day_of_week = DAYS.index(word) 108 | elif word.isdigit(): 109 | day = int(word) 110 | else: 111 | for ext in DAY_EXTENSIONS: 112 | found = word.find(ext) 113 | if found > 0: 114 | try: 115 | day = int(word[:found]) 116 | except: 117 | pass 118 | 119 | if month < today.month and month != -1: 120 | year = year+1 121 | 122 | 123 | if month == -1 and day != -1: 124 | if day < today.day: 125 | month = today.month + 1 126 | else: 127 | month = today.month 128 | 129 | 130 | if month == -1 and day == -1 and day_of_week != -1: 131 | current_day_of_week = today.weekday() 132 | dif = day_of_week - current_day_of_week 133 | 134 | if dif < 0: 135 | dif += 7 136 | if text.count("next") >= 1: 137 | dif += 7 138 | 139 | return today + datetime.timedelta(dif) 140 | 141 | if day != -1: 142 | return datetime.date(month=month, day=day, year=year) -------------------------------------------------------------------------------- /Jarvis/features/google_search.py: -------------------------------------------------------------------------------- 1 | from selenium import webdriver 2 | from selenium.webdriver.common.keys import Keys 3 | import re, pyttsx3 4 | 5 | 6 | 7 | def speak(text): 8 | engine = pyttsx3.init('sapi5') 9 | voices = engine.getProperty('voices') 10 | engine.setProperty('voices', voices[0].id) 11 | engine.say(text) 12 | engine.runAndWait() 13 | engine.setProperty('rate', 180) 14 | 15 | 16 | def google_search(command): 17 | 18 | reg_ex = re.search('search google for (.*)', command) 19 | search_for = command.split("for", 1)[1] 20 | url = 'https://www.google.com/' 21 | if reg_ex: 22 | subgoogle = reg_ex.group(1) 23 | url = url + 'r/' + subgoogle 24 | speak("Okay sir!") 25 | speak(f"Searching for {subgoogle}") 26 | driver = webdriver.Chrome( 27 | executable_path='driver/chromedriver.exe') 28 | driver.get('https://www.google.com') 29 | search = driver.find_element_by_name('q') 30 | search.send_keys(str(search_for)) 31 | search.send_keys(Keys.RETURN) -------------------------------------------------------------------------------- /Jarvis/features/gui.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | 3 | # Form implementation generated from reading ui file 'gui.ui' 4 | # 5 | # Created by: PyQt5 UI code generator 5.15.2 6 | # 7 | # WARNING: Any manual changes made to this file will be lost when pyuic5 is 8 | # run again. Do not edit this file unless you know what you are doing. 9 | 10 | 11 | from PyQt5 import QtCore, QtGui, QtWidgets 12 | 13 | 14 | class Ui_MainWindow(object): 15 | def setupUi(self, MainWindow): 16 | MainWindow.setObjectName("Jarvis 2.0") 17 | MainWindow.resize(1440, 900) 18 | self.centralwidget = QtWidgets.QWidget(MainWindow) 19 | self.centralwidget.setObjectName("centralwidget") 20 | self.label = QtWidgets.QLabel(self.centralwidget) 21 | self.label.setGeometry(QtCore.QRect(0, 0, 1440, 900)) 22 | self.label.setText("") 23 | self.label.setPixmap(QtGui.QPixmap("Jarvis/utils/images/live_wallpaper.gif")) 24 | self.label.setScaledContents(True) 25 | self.label.setObjectName("label") 26 | self.pushButton = QtWidgets.QPushButton(self.centralwidget) 27 | self.pushButton.setGeometry(QtCore.QRect(1180, 800, 101, 51)) 28 | self.pushButton.setStyleSheet("background-color: rgb(0, 170, 255);\n" 29 | "font: 75 18pt \"MS Shell Dlg 2\";") 30 | self.pushButton.setObjectName("pushButton") 31 | self.pushButton_2 = QtWidgets.QPushButton(self.centralwidget) 32 | self.pushButton_2.setGeometry(QtCore.QRect(1310, 800, 101, 51)) 33 | self.pushButton_2.setStyleSheet("background-color:rgb(255, 0, 0);\n" 34 | "font: 75 18pt \"MS Shell Dlg 2\";") 35 | self.pushButton_2.setObjectName("pushButton_2") 36 | self.label_2 = QtWidgets.QLabel(self.centralwidget) 37 | self.label_2.setGeometry(QtCore.QRect(10, 10, 401, 91)) 38 | self.label_2.setText("") 39 | self.label_2.setPixmap(QtGui.QPixmap("Jarvis/utils/images/initiating.gif")) 40 | self.label_2.setObjectName("label_2") 41 | self.textBrowser = QtWidgets.QTextBrowser(self.centralwidget) 42 | self.textBrowser.setGeometry(QtCore.QRect(640, 30, 291, 61)) 43 | self.textBrowser.setStyleSheet("font: 75 16pt \"MS Shell Dlg 2\";\n" 44 | "background-color:transparent;\ncolor:white;" 45 | "border-radius:none;\n" 46 | "") 47 | self.textBrowser.setObjectName("textBrowser") 48 | self.textBrowser_2 = QtWidgets.QTextBrowser(self.centralwidget) 49 | self.textBrowser_2.setGeometry(QtCore.QRect(930, 30, 291, 61)) 50 | self.textBrowser_2.setStyleSheet("font: 75 16pt \"MS Shell Dlg 2\";\n" 51 | "background-color:transparent;\ncolor:white;" 52 | "border-radius:none;") 53 | self.textBrowser_2.setObjectName("textBrowser_2") 54 | self.textBrowser_3 = QtWidgets.QTextBrowser(self.centralwidget) 55 | self.textBrowser_3.setGeometry(QtCore.QRect(1000, 500, 431, 281)) 56 | self.textBrowser_3.setStyleSheet("font: 11pt \"MS Shell Dlg 2\";\n" 57 | "background-color:transparent;\ncolor:white;") 58 | self.textBrowser_3.setObjectName("textBrowser_3") 59 | MainWindow.setCentralWidget(self.centralwidget) 60 | self.menubar = QtWidgets.QMenuBar(MainWindow) 61 | self.menubar.setGeometry(QtCore.QRect(0, 0, 1440, 26)) 62 | self.menubar.setObjectName("menubar") 63 | MainWindow.setMenuBar(self.menubar) 64 | self.statusbar = QtWidgets.QStatusBar(MainWindow) 65 | self.statusbar.setObjectName("statusbar") 66 | MainWindow.setStatusBar(self.statusbar) 67 | 68 | self.retranslateUi(MainWindow) 69 | QtCore.QMetaObject.connectSlotsByName(MainWindow) 70 | 71 | def retranslateUi(self, MainWindow): 72 | _translate = QtCore.QCoreApplication.translate 73 | MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow")) 74 | self.pushButton.setText(_translate("MainWindow", "Run")) 75 | self.pushButton_2.setText(_translate("MainWindow", "Exit")) 76 | 77 | 78 | if __name__ == "__main__": 79 | import sys 80 | app = QtWidgets.QApplication(sys.argv) 81 | MainWindow = QtWidgets.QMainWindow() 82 | ui = Ui_MainWindow() 83 | ui.setupUi(MainWindow) 84 | MainWindow.show() 85 | sys.exit(app.exec_()) 86 | -------------------------------------------------------------------------------- /Jarvis/features/launch_app.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | 3 | def launch_app(path_of_app): 4 | try: 5 | subprocess.call([path_of_app]) 6 | return True 7 | except Exception as e: 8 | print(e) 9 | return False -------------------------------------------------------------------------------- /Jarvis/features/loc.py: -------------------------------------------------------------------------------- 1 | import webbrowser, requests 2 | from geopy.geocoders import Nominatim 3 | from geopy.distance import great_circle 4 | import geocoder 5 | 6 | def loc(place): 7 | webbrowser.open("http://www.google.com/maps/place/" + place + "") 8 | geolocator = Nominatim(user_agent="myGeocoder") 9 | location = geolocator.geocode(place, addressdetails=True) 10 | target_latlng = location.latitude, location.longitude 11 | location = location.raw['address'] 12 | target_loc = {'city': location.get('city', ''), 13 | 'state': location.get('state', ''), 14 | 'country': location.get('country', '')} 15 | 16 | current_loc = geocoder.ip('me') 17 | current_latlng = current_loc.latlng 18 | 19 | distance = str(great_circle(current_latlng, target_latlng)) 20 | distance = str(distance.split(' ',1)[0]) 21 | distance = round(float(distance), 2) 22 | 23 | return current_loc, target_loc, distance 24 | 25 | def my_location(): 26 | ip_add = requests.get('https://api.ipify.org').text 27 | url = 'https://get.geojs.io/v1/ip/geo/' + ip_add + '.json' 28 | geo_requests = requests.get(url) 29 | geo_data = geo_requests.json() 30 | city = geo_data['city'] 31 | state = geo_data['region'] 32 | country = geo_data['country'] 33 | 34 | return city, state,country 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Jarvis/features/news.py: -------------------------------------------------------------------------------- 1 | import requests 2 | import json 3 | 4 | 5 | 6 | def get_news(): 7 | url = 'http://newsapi.org/v2/top-headlines?sources=the-times-of-india&apiKey=ae5ccbe2006a4debbe6424d7e4b569ec' 8 | news = requests.get(url).text 9 | news_dict = json.loads(news) 10 | articles = news_dict['articles'] 11 | try: 12 | 13 | return articles 14 | except: 15 | return False 16 | 17 | 18 | def getNewsUrl(): 19 | return 'http://newsapi.org/v2/top-headlines?sources=the-times-of-india&apiKey=ae5ccbe2006a4debbe6424d7e4b569ec' 20 | -------------------------------------------------------------------------------- /Jarvis/features/note.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import datetime 3 | 4 | def note(text): 5 | date = datetime.datetime.now() 6 | file_name = str(date).replace(":", "-") + "-note.txt" 7 | with open(file_name, "w") as f: 8 | f.write(text) 9 | notepad = "C://Program Files (x86)//Notepad++//notepad++.exe" 10 | subprocess.Popen([notepad, file_name]) 11 | 12 | -------------------------------------------------------------------------------- /Jarvis/features/send_email.py: -------------------------------------------------------------------------------- 1 | import smtplib 2 | 3 | 4 | def mail(sender_email, sender_password, receiver_email, msg): 5 | try: 6 | mail = smtplib.SMTP('smtp.gmail.com', 587) 7 | mail.ehlo() 8 | mail.starttls() 9 | mail.login(sender_email, sender_password) 10 | mail.sendmail(sender_email, receiver_email, msg) 11 | mail.close() 12 | return True 13 | except Exception as e: 14 | print(e) 15 | return False -------------------------------------------------------------------------------- /Jarvis/features/system_stats.py: -------------------------------------------------------------------------------- 1 | import psutil, pyttsx3, math 2 | 3 | def convert_size(size_bytes): 4 | if size_bytes == 0: 5 | return "0B" 6 | size_name = ("B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB") 7 | i = int(math.floor(math.log(size_bytes, 1024))) 8 | p = math.pow(1024, i) 9 | s = round(size_bytes / p, 2) 10 | print("%s %s" % (s, size_name[i])) 11 | return "%s %s" % (s, size_name[i]) 12 | 13 | 14 | def system_stats(): 15 | cpu_stats = str(psutil.cpu_percent()) 16 | battery_percent = psutil.sensors_battery().percent 17 | memory_in_use = convert_size(psutil.virtual_memory().used) 18 | total_memory = convert_size(psutil.virtual_memory().total) 19 | final_res = f"Currently {cpu_stats} percent of CPU, {memory_in_use} of RAM out of total {total_memory} is being used and battery level is at {battery_percent} percent" 20 | return final_res 21 | 22 | -------------------------------------------------------------------------------- /Jarvis/features/weather.py: -------------------------------------------------------------------------------- 1 | import requests 2 | from Jarvis.config import config 3 | 4 | 5 | 6 | def fetch_weather(city): 7 | """ 8 | City to weather 9 | :param city: City 10 | :return: weather 11 | """ 12 | api_key = config.weather_api_key 13 | units_format = "&units=metric" 14 | 15 | base_url = "http://api.openweathermap.org/data/2.5/weather?q=" 16 | complete_url = base_url + city + "&appid=" + api_key + units_format 17 | 18 | response = requests.get(complete_url) 19 | 20 | city_weather_data = response.json() 21 | 22 | if city_weather_data["cod"] != "404": 23 | main_data = city_weather_data["main"] 24 | weather_description_data = city_weather_data["weather"][0] 25 | weather_description = weather_description_data["description"] 26 | current_temperature = main_data["temp"] 27 | current_pressure = main_data["pressure"] 28 | current_humidity = main_data["humidity"] 29 | wind_data = city_weather_data["wind"] 30 | wind_speed = wind_data["speed"] 31 | 32 | final_response = f""" 33 | The weather in {city} is currently {weather_description} 34 | with a temperature of {current_temperature} degree celcius, 35 | atmospheric pressure of {current_pressure} hectoPascals, 36 | humidity of {current_humidity} percent 37 | and wind speed reaching {wind_speed} kilometers per hour""" 38 | 39 | return final_response 40 | 41 | else: 42 | return "Sorry Sir, I couldn't find the city in my database. Please try again" -------------------------------------------------------------------------------- /Jarvis/features/website_open.py: -------------------------------------------------------------------------------- 1 | import webbrowser 2 | 3 | def website_opener(domain): 4 | try: 5 | url = 'https://www.' + domain 6 | webbrowser.open(url) 7 | return True 8 | except Exception as e: 9 | print(e) 10 | return False -------------------------------------------------------------------------------- /Jarvis/features/wikipedia.py: -------------------------------------------------------------------------------- 1 | import wikipedia 2 | import re 3 | 4 | def tell_me_about(topic): 5 | try: 6 | # info = str(ny.content[:500].encode('utf-8')) 7 | # res = re.sub('[^a-zA-Z.\d\s]', '', info)[1:] 8 | res = wikipedia.summary(topic, sentences=3) 9 | 10 | return res 11 | except Exception as e: 12 | print(e) 13 | return False 14 | -------------------------------------------------------------------------------- /Jarvis/features/youtube_search.py: -------------------------------------------------------------------------------- 1 | import webbrowser, urllib, re 2 | import urllib.parse 3 | import urllib.request 4 | 5 | domain = input("Enter the song name: ") 6 | song = urllib.parse.urlencode({"search_query" : domain}) 7 | print("Song" + song) 8 | 9 | # fetch the ?v=query_string 10 | result = urllib.request.urlopen("http://www.youtube.com/results?" + song) 11 | print(result) 12 | 13 | # make the url of the first result song 14 | search_results = re.findall(r'href=\"\/watch\?v=(.{4})', result.read().decode()) 15 | print(search_results) 16 | 17 | # make the final url of song selects the very first result from youtube result 18 | url = "http://www.youtube.com/watch?v="+str(search_results) 19 | 20 | # play the song using webBrowser module which opens the browser 21 | # webbrowser.open(url, new = 1) 22 | webbrowser.open_new(url) -------------------------------------------------------------------------------- /Jarvis/utils/images/initiating.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gladiator07/JARVIS/83aa2ee2b81d0aa9e8399c4ef599d992b6a3bf67/Jarvis/utils/images/initiating.gif -------------------------------------------------------------------------------- /Jarvis/utils/images/live_wallpaper.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gladiator07/JARVIS/83aa2ee2b81d0aa9e8399c4ef599d992b6a3bf67/Jarvis/utils/images/live_wallpaper.gif -------------------------------------------------------------------------------- /Jarvis/utils/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gladiator07/JARVIS/83aa2ee2b81d0aa9e8399c4ef599d992b6a3bf67/Jarvis/utils/images/loading.gif -------------------------------------------------------------------------------- /Jarvis/utils/images/loading_1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gladiator07/JARVIS/83aa2ee2b81d0aa9e8399c4ef599d992b6a3bf67/Jarvis/utils/images/loading_1.gif -------------------------------------------------------------------------------- /Jarvis/utils/images/program_load.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gladiator07/JARVIS/83aa2ee2b81d0aa9e8399c4ef599d992b6a3bf67/Jarvis/utils/images/program_load.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Atharva Ingle 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JARVIS (Just a Rather Very Intelligent System) 2 | 3 | #### This was my attempt to make a voice assistant similar to JARVIS (in iron man movie) 4 | #### Let's be honest, it's not as intelligent as in the movie, but it can do a lot of cool things and automate your daily tasks you do on your personal computers/laptops. 5 | 6 | ## Built with 7 | 8 | 9 | 10 | 11 | ## Features 12 | 13 | #### For a cool demo of this project watch this [YouTube video](https://www.youtube.com/watch?v=oKtrHy0ERNA) 14 | 15 | It can do a lot of cool things, some of them being: 16 | 17 | - Greet user 18 | - Tell current time and date 19 | - Launch applications/softwares 20 | - Open any website 21 | - Tells about weather of any city 22 | - Open location of any place plus tells the distance between your place and queried place 23 | - Tells your current system status (RAM Usage, battery health, CPU usage) 24 | - Tells about your upcoming events (Google Calendar) 25 | - Tells about any person (via Wikipedia) 26 | - Can search anything on Google 27 | - Can play any song on YouTube 28 | - Tells top headlines (via Times of India) 29 | - Plays music 30 | - Send email (with subject and content) 31 | - Calculate any mathematical expression (example: Jarvis, calculate x + 135 - 234 = 345) 32 | - Answer any generic question (via Wolframalpha) 33 | - Take important note in notepad 34 | - Tells a random joke 35 | - Tells your IP address 36 | - Can switch the window 37 | - Can take screenshot and save it with custom filename 38 | - Can hide all files in a folder and also make them visible again 39 | - Has a cool Graphical User Interface 40 | 41 | ## API Keys 42 | To run this program you will require a bunch of API keys. Register your API key by clicking the following links 43 | 44 | - [OpenWeatherMap API](https://openweathermap.org/api) 45 | - [Wolframalpha](https://www.wolframalpha.com/) 46 | - [Google Calendar API](https://developers.google.com/calendar/auth) 47 | 48 | ## Installation 49 | 50 | - First clone the repo 51 | - Make a config.py file and include the following in it: 52 | ```weather_api_key = "" 53 | email = "" 54 | email_password = "" 55 | wolframalpha_id = "" 56 | - Copy the config.py file in Jarvis>config folder 57 | - Make a new python environment 58 | If you are using anaconda just type ```conda create -n jarvis python==3.8.5 ``` in anaconda prompt 59 | - To activate the environment ``` conda activate jarvis ``` 60 | - Navigate to the directory of your project 61 | - Install all the requirements by just hitting ``` pip install -r requirements.txt ``` 62 | - Install PyAudio from wheel file by following instructions given [here](https://stackoverflow.com/a/55630212) 63 | - Run the program by ``` python main.py ``` 64 | - Enjoy !!!! 65 | 66 | ## Code Structure 67 | 68 | 69 | ├── driver 70 | ├── Jarvis # Main folder for features 71 | │ ├── config # Contains all secret API Keys 72 | │ ├── features # All functionalities of JARVIS 73 | │ └── utils # GUI images 74 | ├── __init__.py # Definition of feature's functions 75 | ├── gui.ui # GUI file (in .ui format) 76 | ├── main.py # main driver program of Jarvis 77 | ├── requirements.txt # all dependencies of the program 78 | 79 | - The code structure if pretty simple. The code is completely modularized and is highly customizable 80 | - To add a new feature: 81 | - Make a new file in features folder, write the feature's function you want to include 82 | - Add the function's definition to __init__.py 83 | - Add the voice commands through which you want to invoke the function 84 | 85 | ## Contribute 86 | Please read [CONTRIBUTING.md](https://github.com/Gladiator07/JARVIS/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests. 87 | 88 | ## License 89 | This project is licensed under [MIT License](https://github.com/Gladiator07/JARVIS/blob/master/LICENSE) 2021 Atharva Ingle 90 | 91 | ## Future Improvements 92 | - Generalized conversations can be made possible by incorporating Natural Language Processing 93 | - GUI can be made more nicer to look at and functional 94 | - More functionalities can be added 95 | -------------------------------------------------------------------------------- /driver/chromedriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gladiator07/JARVIS/83aa2ee2b81d0aa9e8399c4ef599d992b6a3bf67/driver/chromedriver.exe -------------------------------------------------------------------------------- /gui.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 1440 10 | 900 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 0 21 | 0 22 | 1440 23 | 900 24 | 25 | 26 | 27 | 28 | 29 | 30 | Jarvis/utils/images/live_wallpaper.gif 31 | 32 | 33 | true 34 | 35 | 36 | 37 | 38 | 39 | 1180 40 | 790 41 | 101 42 | 51 43 | 44 | 45 | 46 | background-color: rgb(0, 170, 255); 47 | font: 75 18pt "MS Shell Dlg 2"; 48 | 49 | 50 | Run 51 | 52 | 53 | 54 | 55 | 56 | 1310 57 | 790 58 | 101 59 | 51 60 | 61 | 62 | 63 | background-color:rgb(255, 0, 0); 64 | font: 75 18pt "MS Shell Dlg 2"; 65 | 66 | 67 | Exit 68 | 69 | 70 | 71 | 72 | 73 | 10 74 | 10 75 | 401 76 | 91 77 | 78 | 79 | 80 | 81 | 82 | 83 | Jarvis/utils/images/initiating.gif 84 | 85 | 86 | 87 | 88 | 89 | 640 90 | 30 91 | 291 92 | 61 93 | 94 | 95 | 96 | font: 75 16pt "MS Shell Dlg 2"; 97 | background-color:transparent; 98 | border-radius:none; 99 | 100 | 101 | 102 | 103 | 104 | 105 | 930 106 | 30 107 | 291 108 | 61 109 | 110 | 111 | 112 | font: 75 16pt "MS Shell Dlg 2"; 113 | background-color:transparent; 114 | border-radius:none; 115 | 116 | 117 | 118 | 119 | 120 | 1000 121 | 500 122 | 431 123 | 281 124 | 125 | 126 | 127 | font: 11pt "MS Shell Dlg 2"; 128 | background-color:transparent; 129 | 130 | 131 | 132 | 133 | 134 | 135 | 0 136 | 0 137 | 1440 138 | 26 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from Jarvis import JarvisAssistant 2 | import re 3 | import os 4 | import random 5 | import pprint 6 | import datetime 7 | import requests 8 | import sys 9 | import urllib.parse 10 | import pyjokes 11 | import time 12 | import pyautogui 13 | import pywhatkit 14 | import wolframalpha 15 | from PIL import Image 16 | from PyQt5 import QtWidgets, QtCore, QtGui 17 | from PyQt5.QtCore import QTimer, QTime, QDate, Qt 18 | from PyQt5.QtGui import QMovie 19 | from PyQt5.QtCore import * 20 | from PyQt5.QtGui import * 21 | from PyQt5.QtWidgets import * 22 | from PyQt5.uic import loadUiType 23 | from Jarvis.features.gui import Ui_MainWindow 24 | from Jarvis.config import config 25 | 26 | obj = JarvisAssistant() 27 | 28 | # ================================ MEMORY =========================================================================================================== 29 | 30 | GREETINGS = ["hello jarvis", "jarvis", "wake up jarvis", "you there jarvis", "time to work jarvis", "hey jarvis", 31 | "ok jarvis", "are you there"] 32 | GREETINGS_RES = ["always there for you sir", "i am ready sir", 33 | "your wish my command", "how can i help you sir?", "i am online and ready sir"] 34 | 35 | EMAIL_DIC = { 36 | 'myself': 'atharvaaingle@gmail.com', 37 | 'my official email': 'atharvaaingle@gmail.com', 38 | 'my second email': 'atharvaaingle@gmail.com', 39 | 'my official mail': 'atharvaaingle@gmail.com', 40 | 'my second mail': 'atharvaaingle@gmail.com' 41 | } 42 | 43 | CALENDAR_STRS = ["what do i have", "do i have plans", "am i busy"] 44 | # ======================================================================================================================================================= 45 | 46 | 47 | def speak(text): 48 | obj.tts(text) 49 | 50 | 51 | app_id = config.wolframalpha_id 52 | 53 | 54 | def computational_intelligence(question): 55 | try: 56 | client = wolframalpha.Client(app_id) 57 | answer = client.query(question) 58 | answer = next(answer.results).text 59 | print(answer) 60 | return answer 61 | except: 62 | speak("Sorry sir I couldn't fetch your question's answer. Please try again ") 63 | return None 64 | 65 | def startup(): 66 | speak("Initializing Jarvis") 67 | speak("Starting all systems applications") 68 | speak("Installing and checking all drivers") 69 | speak("Caliberating and examining all the core processors") 70 | speak("Checking the internet connection") 71 | speak("Wait a moment sir") 72 | speak("All drivers are up and running") 73 | speak("All systems have been activated") 74 | speak("Now I am online") 75 | hour = int(datetime.datetime.now().hour) 76 | if hour>=0 and hour<=12: 77 | speak("Good Morning") 78 | elif hour>12 and hour<18: 79 | speak("Good afternoon") 80 | else: 81 | speak("Good evening") 82 | c_time = obj.tell_time() 83 | speak(f"Currently it is {c_time}") 84 | speak("I am Jarvis. Online and ready sir. Please tell me how may I help you") 85 | 86 | 87 | 88 | 89 | def wish(): 90 | hour = int(datetime.datetime.now().hour) 91 | if hour>=0 and hour<=12: 92 | speak("Good Morning") 93 | elif hour>12 and hour<18: 94 | speak("Good afternoon") 95 | else: 96 | speak("Good evening") 97 | c_time = obj.tell_time() 98 | speak(f"Currently it is {c_time}") 99 | speak("I am Jarvis. Online and ready sir. Please tell me how may I help you") 100 | # if __name__ == "__main__": 101 | 102 | 103 | class MainThread(QThread): 104 | def __init__(self): 105 | super(MainThread, self).__init__() 106 | 107 | def run(self): 108 | self.TaskExecution() 109 | 110 | def TaskExecution(self): 111 | startup() 112 | wish() 113 | 114 | while True: 115 | command = obj.mic_input() 116 | 117 | if re.search('date', command): 118 | date = obj.tell_me_date() 119 | print(date) 120 | speak(date) 121 | 122 | elif "time" in command: 123 | time_c = obj.tell_time() 124 | print(time_c) 125 | speak(f"Sir the time is {time_c}") 126 | 127 | elif re.search('launch', command): 128 | dict_app = { 129 | 'chrome': 'C:/Program Files/Google/Chrome/Application/chrome' 130 | } 131 | 132 | app = command.split(' ', 1)[1] 133 | path = dict_app.get(app) 134 | 135 | if path is None: 136 | speak('Application path not found') 137 | print('Application path not found') 138 | 139 | else: 140 | speak('Launching: ' + app + 'for you sir!') 141 | obj.launch_any_app(path_of_app=path) 142 | 143 | elif command in GREETINGS: 144 | speak(random.choice(GREETINGS_RES)) 145 | 146 | elif re.search('open', command): 147 | domain = command.split(' ')[-1] 148 | open_result = obj.website_opener(domain) 149 | speak(f'Alright sir !! Opening {domain}') 150 | print(open_result) 151 | 152 | elif re.search('weather', command): 153 | city = command.split(' ')[-1] 154 | weather_res = obj.weather(city=city) 155 | print(weather_res) 156 | speak(weather_res) 157 | 158 | elif re.search('tell me about', command): 159 | topic = command.split(' ')[-1] 160 | if topic: 161 | wiki_res = obj.tell_me(topic) 162 | print(wiki_res) 163 | speak(wiki_res) 164 | else: 165 | speak( 166 | "Sorry sir. I couldn't load your query from my database. Please try again") 167 | 168 | elif "buzzing" in command or "news" in command or "headlines" in command: 169 | news_res = obj.news() 170 | speak('Source: The Times Of India') 171 | speak('Todays Headlines are..') 172 | for index, articles in enumerate(news_res): 173 | pprint.pprint(articles['title']) 174 | speak(articles['title']) 175 | if index == len(news_res)-2: 176 | break 177 | speak('These were the top headlines, Have a nice day Sir!!..') 178 | 179 | elif 'search google for' in command: 180 | obj.search_anything_google(command) 181 | 182 | elif "play music" in command or "hit some music" in command: 183 | music_dir = "F://Songs//Imagine_Dragons" 184 | songs = os.listdir(music_dir) 185 | for song in songs: 186 | os.startfile(os.path.join(music_dir, song)) 187 | 188 | elif 'youtube' in command: 189 | video = command.split(' ')[1] 190 | speak(f"Okay sir, playing {video} on youtube") 191 | pywhatkit.playonyt(video) 192 | 193 | elif "email" in command or "send email" in command: 194 | sender_email = config.email 195 | sender_password = config.email_password 196 | 197 | try: 198 | speak("Whom do you want to email sir ?") 199 | recipient = obj.mic_input() 200 | receiver_email = EMAIL_DIC.get(recipient) 201 | if receiver_email: 202 | 203 | speak("What is the subject sir ?") 204 | subject = obj.mic_input() 205 | speak("What should I say?") 206 | message = obj.mic_input() 207 | msg = 'Subject: {}\n\n{}'.format(subject, message) 208 | obj.send_mail(sender_email, sender_password, 209 | receiver_email, msg) 210 | speak("Email has been successfully sent") 211 | time.sleep(2) 212 | 213 | else: 214 | speak( 215 | "I coudn't find the requested person's email in my database. Please try again with a different name") 216 | 217 | except: 218 | speak("Sorry sir. Couldn't send your mail. Please try again") 219 | 220 | elif "calculate" in command: 221 | question = command 222 | answer = computational_intelligence(question) 223 | speak(answer) 224 | 225 | elif "what is" in command or "who is" in command: 226 | question = command 227 | answer = computational_intelligence(question) 228 | speak(answer) 229 | 230 | elif "what do i have" in command or "do i have plans" or "am i busy" in command: 231 | obj.google_calendar_events(command) 232 | 233 | if "make a note" in command or "write this down" in command or "remember this" in command: 234 | speak("What would you like me to write down?") 235 | note_text = obj.mic_input() 236 | obj.take_note(note_text) 237 | speak("I've made a note of that") 238 | 239 | elif "close the note" in command or "close notepad" in command: 240 | speak("Okay sir, closing notepad") 241 | os.system("taskkill /f /im notepad++.exe") 242 | 243 | if "joke" in command: 244 | joke = pyjokes.get_joke() 245 | print(joke) 246 | speak(joke) 247 | 248 | elif "system" in command: 249 | sys_info = obj.system_info() 250 | print(sys_info) 251 | speak(sys_info) 252 | 253 | elif "where is" in command: 254 | place = command.split('where is ', 1)[1] 255 | current_loc, target_loc, distance = obj.location(place) 256 | city = target_loc.get('city', '') 257 | state = target_loc.get('state', '') 258 | country = target_loc.get('country', '') 259 | time.sleep(1) 260 | try: 261 | 262 | if city: 263 | res = f"{place} is in {state} state and country {country}. It is {distance} km away from your current location" 264 | print(res) 265 | speak(res) 266 | 267 | else: 268 | res = f"{state} is a state in {country}. It is {distance} km away from your current location" 269 | print(res) 270 | speak(res) 271 | 272 | except: 273 | res = "Sorry sir, I couldn't get the co-ordinates of the location you requested. Please try again" 274 | speak(res) 275 | 276 | elif "ip address" in command: 277 | ip = requests.get('https://api.ipify.org').text 278 | print(ip) 279 | speak(f"Your ip address is {ip}") 280 | 281 | elif "switch the window" in command or "switch window" in command: 282 | speak("Okay sir, Switching the window") 283 | pyautogui.keyDown("alt") 284 | pyautogui.press("tab") 285 | time.sleep(1) 286 | pyautogui.keyUp("alt") 287 | 288 | elif "where i am" in command or "current location" in command or "where am i" in command: 289 | try: 290 | city, state, country = obj.my_location() 291 | print(city, state, country) 292 | speak( 293 | f"You are currently in {city} city which is in {state} state and country {country}") 294 | except Exception as e: 295 | speak( 296 | "Sorry sir, I coundn't fetch your current location. Please try again") 297 | 298 | elif "take screenshot" in command or "take a screenshot" in command or "capture the screen" in command: 299 | speak("By what name do you want to save the screenshot?") 300 | name = obj.mic_input() 301 | speak("Alright sir, taking the screenshot") 302 | img = pyautogui.screenshot() 303 | name = f"{name}.png" 304 | img.save(name) 305 | speak("The screenshot has been succesfully captured") 306 | 307 | elif "show me the screenshot" in command: 308 | try: 309 | img = Image.open('D://JARVIS//JARVIS_2.0//' + name) 310 | img.show(img) 311 | speak("Here it is sir") 312 | time.sleep(2) 313 | 314 | except IOError: 315 | speak("Sorry sir, I am unable to display the screenshot") 316 | 317 | elif "hide all files" in command or "hide this folder" in command: 318 | os.system("attrib +h /s /d") 319 | speak("Sir, all the files in this folder are now hidden") 320 | 321 | elif "visible" in command or "make files visible" in command: 322 | os.system("attrib -h /s /d") 323 | speak("Sir, all the files in this folder are now visible to everyone. I hope you are taking this decision in your own peace") 324 | 325 | # if "calculate" in command or "what is" in command: 326 | # query = command 327 | # answer = computational_intelligence(query) 328 | # speak(answer) 329 | 330 | 331 | 332 | elif "goodbye" in command or "offline" in command or "bye" in command: 333 | speak("Alright sir, going offline. It was nice working with you") 334 | sys.exit() 335 | 336 | 337 | startExecution = MainThread() 338 | 339 | 340 | class Main(QMainWindow): 341 | def __init__(self): 342 | super().__init__() 343 | self.ui = Ui_MainWindow() 344 | self.ui.setupUi(self) 345 | self.ui.pushButton.clicked.connect(self.startTask) 346 | self.ui.pushButton_2.clicked.connect(self.close) 347 | 348 | def __del__(self): 349 | sys.stdout = sys.__stdout__ 350 | 351 | # def run(self): 352 | # self.TaskExection 353 | def startTask(self): 354 | self.ui.movie = QtGui.QMovie("Jarvis/utils/images/live_wallpaper.gif") 355 | self.ui.label.setMovie(self.ui.movie) 356 | self.ui.movie.start() 357 | self.ui.movie = QtGui.QMovie("Jarvis/utils/images/initiating.gif") 358 | self.ui.label_2.setMovie(self.ui.movie) 359 | self.ui.movie.start() 360 | timer = QTimer(self) 361 | timer.timeout.connect(self.showTime) 362 | timer.start(1000) 363 | startExecution.start() 364 | 365 | def showTime(self): 366 | current_time = QTime.currentTime() 367 | current_date = QDate.currentDate() 368 | label_time = current_time.toString('hh:mm:ss') 369 | label_date = current_date.toString(Qt.ISODate) 370 | self.ui.textBrowser.setText(label_date) 371 | self.ui.textBrowser_2.setText(label_time) 372 | 373 | 374 | app = QApplication(sys.argv) 375 | jarvis = Main() 376 | jarvis.show() 377 | exit(app.exec_()) 378 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | astroid==2.4.2 2 | attrs==20.3.0 3 | autopep8==1.5.4 4 | beautifulsoup4==4.9.3 5 | cachetools==4.1.1 6 | certifi==2020.11.8 7 | chardet==3.0.4 8 | click==7.1.2 9 | colorama==0.4.4 10 | comtypes==1.1.7 11 | decorator==4.4.2 12 | flake8==3.8.4 13 | future==0.18.2 14 | geocoder==1.38.1 15 | geographiclib==1.50 16 | geopy==2.0.0 17 | google-api-core==1.23.0 18 | google-api-python-client==1.12.8 19 | google-auth==1.23.0 20 | google-auth-httplib2==0.0.4 21 | google-auth-oauthlib==0.4.2 22 | googleapis-common-protos==1.52.0 23 | httplib2==0.18.1 24 | hurry==1.1 25 | hurry.filesize==0.9 26 | idna==2.10 27 | isort==5.6.4 28 | lazy-object-proxy==1.4.3 29 | lxml==4.6.2 30 | mccabe==0.6.1 31 | more-itertools==8.6.0 32 | MouseInfo==0.1.3 33 | numpy==1.19.5 34 | oauthlib==3.1.0 35 | Pillow==8.0.1 36 | pprintpp==0.4.0 37 | protobuf==3.14.0 38 | psutil==5.7.3 39 | pyasn1==0.4.8 40 | pyasn1-modules==0.2.8 41 | PyAutoGUI==0.9.52 42 | pycodestyle==2.6.0 43 | pyflakes==2.2.0 44 | PyGetWindow==0.0.9 45 | pyjokes==0.6.0 46 | pylint==2.6.0 47 | PyMsgBox==1.0.9 48 | pyperclip==1.8.1 49 | pypiwin32==223 50 | PyQt5==5.15.2 51 | pyqt5-plugins==5.15.2.2.0.1 52 | PyQt5-sip==12.8.1 53 | pyqt5-tools==5.15.2.3 54 | PyRect==0.1.4 55 | PyScreeze==0.1.26 56 | python-dotenv==0.15.0 57 | pyttsx3==2.90 58 | PyTweening==1.0.3 59 | pytz==2020.4 60 | pywhatkit==3.2 61 | pywin32==300 62 | qt5-applications==5.15.2.2.1 63 | qt5-tools==5.15.2.1.0.1 64 | ratelim==0.1.6 65 | requests==2.25.0 66 | requests-oauthlib==1.3.0 67 | rsa==4.6 68 | selenium==3.141.0 69 | six==1.15.0 70 | soupsieve==2.0.1 71 | SpeechRecognition==3.8.1 72 | toml==0.10.2 73 | uritemplate==3.0.1 74 | urllib3==1.26.2 75 | wikipedia==1.4.0 76 | wincertstore==0.2 77 | wolframalpha==4.1.1 78 | wrapt==1.12.1 79 | xml-python==0.3.5 80 | xmltodict==0.12.0 81 | --------------------------------------------------------------------------------