Repository navigation
Expand file tree
/
Copy pathstart-Tray_Icon.py
More file actions
63 lines (51 loc) · 1.78 KB
/
Copy pathstart-Tray_Icon.py
File metadata and controls
63 lines (51 loc) · 1.78 KB
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
import os
import speech_recognition as sr
import requests
import pystray
import PIL.Image
import threading
import time
wled_IP_Addr = "http://192.168.0.90"
def TrayIcon():
image = PIL.Image.open("./VideoEffects/jarvis.png")
def on_clicked(icon,item):
if str(item)=="Led On":
requests.get(f"{wled_IP_Addr}/win&T=1")
elif str(item)=="Led Off":
requests.get(f"{wled_IP_Addr}/win&T=0")
elif str(item)=="Exit":
os.system("taskkill /f /im Rainmeter.exe")
os.system("taskkill /f /im wallpaper64.exe")
icon.stop()
icon = pystray.Icon("Jarvis",image,menu=pystray.Menu(
pystray.MenuItem("Menu",pystray.Menu(
pystray.MenuItem("Led On",on_clicked),
pystray.MenuItem("Led Off",on_clicked)
)),
pystray.MenuItem("Exit",on_clicked),
))
icon.run()
def takecommand():
command = sr.Recognizer()
with sr.Microphone() as source:
command.energy_threshold = 6500
command.dynamic_energy_threshold = True
audio = command.listen(source,phrase_time_limit=15)
try:
query = command.recognize_google(audio, language='tr-TR')
except Exception:
return ""
return query.lower()
t1 = threading.Thread(target=TrayIcon)
t1.start()
#playsound("./SoundEffects/open2.mp3")
while True:
if t1.is_alive()==True:
start = takecommand()
if start == "uyan" or start == "uyan jarvis" or start == "hey jarvis":
os.startfile('jarvis-turkce2.py')
if start == "wake up" or start == "wake up jarvis":
os.startfile('jarvis-english2.py')
elif t1.is_alive()==False:
print("exiting")
exit()