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
|
import pywhatkit
import wikipedia
from pywikihow import RandomHowTo, search_wikihow
import os
import speech_recognition as sr
import webbrowser as web
import bs4
import pyttsx3
from time import sleep
import requests
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voices',voices[0].id)
def Speak(audio):
print(" ")
print(f": {audio}")
engine.say(audio)
engine.runAndWait()
print(" ")
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(f": Your Command : {query}\n")
except:
return ""
return query.lower()
def GoogleSearch(term):
query = term.replace("zara","")
query = query.replace("what is","")
query = query.replace("how to","")
query = query.replace("what is","")
query = query.replace(" ","")
query = query.replace("what do you mean by","")
writeab = str(query)
oooooo = open('E:\\Zara\\Data.txt','a')
oooooo.write(writeab)
oooooo.close()
Query = str(term)
pywhatkit.search(Query)
os.startfile('E:\\Zara\\DataBase\\ExtraPro\\start.py')
if 'how to' in Query:
max_result = 1
how_to_func = search_wikihow(query=Query,max_results=max_result)
assert len(how_to_func) == 1
how_to_func[0].print()
Speak(how_to_func[0].summary)
else:
search = wikipedia.summary(Query,2)
Speak(f": According To Your Search : {search}")
def YouTubeSearch(term):
result = "https://www.youtube.com/results?search_query=" + term
web.open(result)
Speak("This Is What I Found For Your Search .")
pywhatkit.playonyt(term)
Speak("This May Also Help You Sir .")
def Alarm(query):
TimeHere= open('E:\\Zara\\Data.txt','a')
TimeHere.write(query)
TimeHere.close()
os.startfile("E:\\Zara\\DataBase\\ExtraPro\\Alarm.py")
def DownloadYouTube():
from pytube import YouTube
from pyautogui import click
from pyautogui import hotkey
import pyperclip
from time import sleep
sleep(2)
click(x=942,y=59)
hotkey('ctrl','c')
value = pyperclip.paste()
Link = str(value) # Important
def Download(link):
url = YouTube(link)
video = url.streams.first()
video.download('E:\\Zara\\DataBase\\YouTube\\')
Download(Link)
Speak("Done Sir , I Have Downloaded The Video .")
Speak("You Can Go And Check It Out.")
os.startfile('E:\\Zara\\DataBase\\YouTube\\')
def SpeedTest():
os.startfile("E:\\Zara\\DataBase\\Gui Programs\\SpeedTestGui.py")
def DateConverter(Query):
Date = Query.replace(" and ","-")
Date = Date.replace(" and ","-")
Date = Date.replace("and","-")
Date = Date.replace("and","-")
Date = Date.replace(" ","")
return str(Date)
def My_Location():
op = "hhttps://www.google.com/maps/place/Cuttack,+Odisha/@20.4632542,85.7977048,23070m/data=!3m2!1e3!4b1!4m13!1m7!3m6!1s0x390cfd5b347eb62d:0x37205b715389640!2sDelhi!3b1!8m2!3d28.7040592!4d77.1024902!3m4!1s0x3a190d832223af81:0x22f5fa1c913be52e!8m2!3d20.4625201!4d85.8830023"
Speak("Checking....")
web.open(op)
ip_add = requests.get('https://api.ipify.org').text
url = 'https://get.geojs.io/v1/ip/geo/' + ip_add + '.json'
geo_q = requests.get(url)
geo_d = geo_q.json()
state = geo_d['city']
country = geo_d['country']
Speak(f"Sir , You Are Now In {state , country} .")
def CoronaVirus(Country):
countries = str(Country).replace(" ","")
url = f"https://www.worldometers.info/coronavirus/country/{countries}/"
result = requests.get(url)
soups = bs4.BeautifulSoup(result.text,'lxml')
corona = soups.find_all('div',class_ = 'maincounter-number')
Data = []
for case in corona:
span = case.find('span')
Data.append(span.string)
cases , Death , recovored = Data
Speak(f"Cases : {cases}")
Speak(f"Deaths : {Death}")
Speak(f"Recovered : {recovored}")
|