-
Notifications
You must be signed in to change notification settings - Fork 0
/
Friday(updated).py
225 lines (187 loc) · 5.91 KB
/
Friday(updated).py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
import pyttsx3
import datetime
import speech_recognition as sr
import wikipedia
import smtplib
import webbrowser as wb
import os
import pyautogui
import psutil
import pyjokes
from covid import Covid
from quotes import Quotes
import pywhatkit as kit
en=pyttsx3.init()
#en.say("hello this is Jarvis")
voices = en.getProperty('voices')
en.setProperty('voice' ,voices[1].id)
def speak(audio):
en.say(audio)
en.runAndWait()
speak("hey boss this is friday and I am ai assistant")
def time():
Time=datetime.datetime.now().strftime("%I:%M:%S")
speak("time in 24 hrs format and is")
speak(Time)
#time()
def quotes():
quotes = Quotes()
persons = quotes.random()
l=str(persons[1])
print(l,"\n")
speak(l)
def date():
year= int(datetime.datetime.now().year)
month= int(datetime.datetime.now().month)
date= int(datetime.datetime.now().day)
speak("date is")
speak(date)
speak("month is")
speak(month)
speak("year is")
speak(year)
#date()
def wishme():
speak("welcome back boss!")
#speak("current time in 24 hrs format and it is")
##time()
#speak("current date is")
##date()
hour=datetime.datetime.now().hour
if hour>=6 and hour<12:
speak("good morning")
elif hour>=12 and hour<15:
speak("good afternoon")
elif hour>=15 and hour<20:
speak("good evening")
elif hour>=20 and hour<24:
speak("good night")
else:
speak("good night")
speak("friday at your service tell meh how can i help you")
#wishme()
def takecommand():
r=sr.Recognizer()
with sr.Microphone() as source:
print("listening....")
r.pause_threshold=1
audio=r.listen(source)
try:
print("recognizing..")
query=r.recognize_google(audio,language='en-in')
print(query)
except Exception as e:
print(e)
speak("say that again boss....")
return "none"
return query
def sendemail(to,content):
server=smtplib.SMTP("smtp.gmail.com",587)
server.eclo()
server.starttls()
server.login('sadiqshaik1211@gmail.com','Sadiqshaik@1234')
server.sendmail('sadiqshaik1211@gmail.com',to,content)
server.close()
def screenshot():
img = pyautogui.screenshot()
img.save("C:\\Users\\sadiq shaik\\Desktop\\car\\ss.png")
def cpu():
usage = str(psutil.cpu_percent())
speak("cpu is at"+usage)
battery = psutil.sensors_battery()
speak("the battery is at")
speak(battery.percent )
def jokes():
speak(pyjokes.get_joke())
def covid():
speak("which country boss ")
case= takecommand().lower()
#covid=Covid(source="worldometers")
covid=Covid()
cases=covid.get_status_by_country_name(str(case))
for x in cases:
print(x,":",cases[x])
def whatsapp():
speak("what you want to send boss")
msg=takecommand().lower()
speak("tell the hour time")
hour=takecommand()
speak("tellthe minutes")
min=takecommand()
kit.sendwhatmsg("+919629595614",str(msg),int(hour),int(min))
def name():
speak("my name is friday")
def boss():
speak("sadiq shaik")
if __name__=="__main__":
wishme()
while True:
query=takecommand().lower()
if 'time'in query:
time()
elif 'boss' in query:
boss()
elif 'date' in query:
date()
elif 'name' in query:
name()
elif 'quotes' in query:
quotes()
elif 'wikipedia' in query:
speak("boss I am searching.....")
query = query.replace("wikipedia","")
result=wikipedia.summary(query,sentences=2)
print("friday:",result)
speak(result)
elif 'send mail' in query:
try:
speak("what should i write ")
content =takecommand()
to='sadiqshaik1211@gmail.com'
sendemail(to,content)
speak("email is sent successfully" )
except Exception as e:
print(e)
speak("I cant able to send due to bad network connection")
elif 'search' in query:
speak("what you want to search")
chromepath="C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s"
search= takecommand().lower()
wb.get(chromepath).open_new_tab(search+'.com')
elif 'log out' in query:
os.system("shutdown -l")
elif 'restart' in query:
os.system("shutdown /r /t 1")
elif 'shutdown' in query:
os.system("shutdown /s /t 1")
elif 'note this one' in query:
speak("what to remember boss")
data = takecommand()
speak("you said me to remember that"+data)
remember=open('data.txt','w')
remember.write(data)
remember.close()
elif 'do you remember anything' in query:
remember=open('data.txt','r')
speak("you said to remember that "+remember.read())
elif 'play songs'in query:
song_dir='C:\\Users\sadiq shaik\Desktop\Musicfiles'
songs=os.listdir(song_dir)
os.startfile(os.path.join(song_dir,songs[1]))
elif 'screenshot' in query:
screenshot()
speak("yeah screenshot is done and yeah it is great content")
elif 'battery' in query:
cpu()
speak("percent")
elif 'covid news' in query:
covid()
elif 'joke' in query:
jokes()
speak("it is really good right hahahaha")
elif " send whatsapp message":
whatsapp()
speak("your msg is sending")
elif "offline" in query:
speak("yep done!")
quit()