Skip to content

Commit 1e474f3

Browse files
authored
Merge pull request Umesh-01#16 from saiadityaviswanadham/main
updated PA.py
2 parents a8a5368 + 3e884ff commit 1e474f3

File tree

2 files changed

+9
-15
lines changed

2 files changed

+9
-15
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__pycache__/

PA.py

+8-15
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import pyttsx3 # pip install pyttsx3
22
import datetime
33
import 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
55
import wikipedia # pip install wikipedia
66
import webbrowser
77
import os
88
import sys
99
import smtplib
1010
from email.message import EmailMessage
1111
import pywhatkit # pip install pywhatkit
12-
import MyAlarm # user-defined
12+
import MyAlarm
13+
import ecapture as ec
1314
import pyjokes # pip install pyjokes
1415
from speedtest import Speedtest # pip install speedtest-cli
1516
from pywikihow import search_wikihow # pip install pywikihow
@@ -28,30 +29,23 @@
2829

2930
engine = pyttsx3.init()
3031

31-
3232
def fun_talk(audio):
3333
engine.say(audio)
3434
engine.runAndWait()
3535

36-
3736
def 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

5248
def 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

Comments
 (0)