-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjacob_brain.py
83 lines (78 loc) · 3.08 KB
/
jacob_brain.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
import speech_recognition as sr
from jacob_web import *
from jacob_speech import *
from jacob_camera import *
from jacob_os import *
import sys
wishme()
bad = ["retard", "fool", "jerk", "idiot", "wimp", "f***", "bimbo", "dumb", "creepy", "weird", "f******", "bastard"]
while True:
def take_command():
r = sr.Recognizer()
r.energy_threshold = 2000
with sr.Microphone() as source:
print("Listening........")
audio = r.listen(source)
try:
print("Recognizing...")
query = r.recognize_google(audio, language='en-in')
print(query)
text = query
if "sleep" in text:
speak("Ok sir, I am going to sleep")
speak("You can wake me up anytime and I will be ready to serve you. Till then take care")
sys.exit(1)
else:
if "YouTube" in text:
if "music" in text:
speak("Opening music videos in YouTube")
youtube("music")
elif "trending" in text:
speak("Opening trending videos in YouTube")
youtube("trending")
elif "gaming" in text:
speak("Opening gaming videos in YouTube")
youtube("gaming")
elif "news" in text:
speak("Opening latest news in YouTube")
youtube("news")
elif "movies" in text:
speak("Opening music videos in YouTube")
youtube("movies")
else:
speak("Opening YouTube")
youtube("")
elif "date" in text:
speak("Today's date is")
date()
elif "skills" in text:
my_skills()
elif any(x in text for x in bad):
bad_words()
elif "joke" in text:
speak("Ha! Ha! Ha!, here goes the joke")
jokes()
elif "camera" in text:
speak("Accessing your device camera")
camera()
elif "Flipkart" in text:
speak("Ordering from Flipkart")
flipkart(text)
elif "Amazon" in text:
speak("Ordering from Amazon")
amazon(text)
elif "calculator" in text:
speak("Accessing your device Calculator")
openCalculator(text)
elif "Notepad" in text:
speak("Accessing your device Notepad")
openNotePad(text)
elif "thank" in text:
thankYou()
else:
speak("Let me search the web for you sir")
web(text)
except sr.UnknownValueError:
speak("Unable to get you !")
speak("Please say that again")
take_command()