-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
58 lines (42 loc) · 1.7 KB
/
main.py
File metadata and controls
58 lines (42 loc) · 1.7 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
from speak import speak
from face_reco import face_reco
from data_handle import add_record, printdf, total_present
from clock import curr_time, today
import pandas as pd
print("------------- Attendance Management System -------------\n")
attendance_dur = 15 # duration of attendance
# time table reading
df = pd.read_csv("timetable.csv", index_col=0)
# printing the time table
print("\t\t\t Time Table")
print(df, "\n")
times = list(df.columns) # timing of attendance for the courses available in the time table
# to not to check for the same time again and again
class_complete = set()
while True:
hr, min, sec = curr_time()
day = today()
if(min > 9):
st = str(hr)+":"+str(min) # time in HH:MM
else:
st = str(hr)+":0"+str(min) # time in HH:MM
# if it is weekend or the time is out of shift auto turn off
if day == "saturday" or day == "sunday":
print("OFF DUTY!")
break
if(hr < 7 or hr >= 19):
print("OFF DUTY!")
break
# if the current time is present in times and not has been recorded for the given minute
if (st not in class_complete) and (st in times):
course = df.at[day, st]
if(not pd.isnull(course)):
class_complete.add(st)
speak(f"Initializing record of {course} for today")
# adding new record with today's date as column name
add_record(course)
start_time = hr*60+min
end_time = start_time+attendance_dur
face_reco(course, end_time)
printdf(course) # print the final attendance sheet after attendance is over
speak(f"{total_present(course)} students present!") # no. of students present