11import pyttsx3 # pip install pyttsx3
22import datetime
33import speech_recognition as sr # pip install SpeechRecognition
4- # import pyaudio # pip install pipwin and then pipwin install pyaudio
4+ import pyaudio # pip install pipwin and then pipwin install pyaudio
55import wikipedia # pip install wikipedia
66import webbrowser
77import os
88import sys
99import smtplib
1010from email .message import EmailMessage
1111import pywhatkit # pip install pywhatkit
12- import MyAlarm # user-defined
12+ import MyAlarm
13+ import ecapture as ec
1314import pyjokes # pip install pyjokes
1415from speedtest import Speedtest # pip install speedtest-cli
1516from pywikihow import search_wikihow # pip install pywikihow
2829
2930engine = pyttsx3 .init ()
3031
31- 3232def fun_talk (audio ):
3333 engine .say (audio )
3434 engine .runAndWait ()
3535
36- 3736def wish_user ():
38- 3937 hour = int (datetime .datetime .now ().hour )
4038 if hour >= 0 and hour < 12 :
4139 fun_talk ("Good Morning !" )
42- 4340 elif hour >= 12 and hour < 18 :
4441 fun_talk ("Good Afternoon !" )
45- 4642 else :
4743 fun_talk ("Good Evening !" )
48- 44+
4945 fun_talk ("I am P.A. (Python Assistant). Tell me how may I help you." )
5046
5147
5248def get_command ():
53- 54- 5549 rec = sr .Recognizer ()
5650 with sr .Microphone () as source :
5751 print ("Listening..." )
@@ -71,12 +65,9 @@ def get_command():
7165 return query
7266
7367
74- if _name_ == '_main_' :
75- 68+ if __name__ == '_main_' :
7669 wish_user ()
77- 78- while True :
79- 70+ while True :
8071 query = get_command ().lower ()
8172
8273 if 'wikipedia' in query :
@@ -243,6 +234,8 @@ def get_mail_info():
243234 elif 'close firefox' in query :
244235 os .system ("TASKKILL /F /IM firefox.exe" )
245236 # subprocess.call(["taskkill", "/F", "/IM", "firefox.exe"])
237+ elif "camera" in command or "take a photo" in command :
238+ ec .capture (0 ,"robo camera" ,"img.jpg" )
246239
247240 elif 'close visual studio code' in query :
248241 os .system ("TASKKILL /F /IM Code.exe" )
0 commit comments