-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.py
108 lines (71 loc) · 2.09 KB
/
main.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
import speech_recognition as sr
import os
import webbrowser as wb
import time
from pydub import AudioSegment
from pydub.playback import play
path = "./require"
roll_call = AudioSegment.from_wav("./require/roll_call.wav")
r1 = sr.Recognizer()
f = open(path+"/names.txt",'r')
lines = f.readlines()
f.close()
names = []
for i in lines:
i = i.rstrip('\n')
names.append(i)
flag = 0
#link = input("Please provide the Goole Meet link\n")
#wb.open(link)
found_names = []
alert_cmd = "notify-send \"YOUR NAME IS BEING CALLED!!!\" \"Return to your meeting ASAP\"; aplay ./require/alert.wav"
at_alert_cmd = "notify-send \"LOOKS LIKE ATTNEDENCE IS GOING ON!!!\" \"Return to your meeting ASAP\"; aplay ./require/alert.wav"
rerun_alert_cmd = "notify-send \"RUN THE BOT AGAIN IF YOU WANT TO CONTINUE\" \"./run.sh\"; aplay ./require/alert.wav"
call_cmd = "./clearall.sh"
at = 0
while True:
flag = 0
f1 = open('./temp/tempfile1.txt','+r')
f2 = open('./temp/tempfile2.txt','+r')
f3 = open('./temp/tempfile3.txt','+r')
l1 = f1.readlines()
l2 = f2.readlines()
l3 = f3.readlines()
temp = l1 + l2 + l3
for i in temp:
i = i.rstrip('\n')
found_names.append(i)
print(found_names,'\n')
if("attendance" in found_names):
os.system(at_alert_cmd)
flag = 1
if("present" in found_names):
at+=1
print("\nPresent Found")
flag = 1
if(at >= 4):
os.system(at_alert_cmd)
at = 0
flag = 1
for i in names:
if(i in found_names) :
print("\nName Found")
flag = 1
os.system(alert_cmd)
break
if(flag == 1):
time.sleep(5)
os.system(call_cmd)
f1.close()
f2.close()
f3.close()
f1 = open('./temp/tempfile1.txt','w').close()
f2 = open('./temp/tempfile2.txt','w').close()
f3 = open('./temp/tempfile3.txt','w').close()
del found_names[:]
if(flag == 1):
time.sleep(5)
os.system(rerun_alert_cmd)
time.sleep(1)
os.system(call_cmd)
time.sleep(4)