-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcberry_bot.py
62 lines (39 loc) · 1.54 KB
/
cberry_bot.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
import mumble_bot
import cberry
import time
import sys
last_event_counter=0
def main():
global last_event_counter
berry =None
while True:
online_users= mumble_bot.read_Online_Users()# set event_counter
registeredUsers= mumble_bot.read_Registered_Users()
if online_users== "sql_no_time_error":
# online user can not be identified
#print ("Server Start Date could not be read -> mumble server restart required")
sys.exit(-1)
one_user_online=False
#check if a user is loged in
for user in online_users:
#print(user+" "+str(online_users[user]))
if online_users[user].event_counter%2!=0:
one_user_online=True
if last_event_counter != mumble_bot.event_counter and len(online_users)!=0: #there is a user stat change
last_event_counter = mumble_bot.event_counter;#reset event counter
#*****************************************************
#********** c-berry part******************************
#*****************************************************
if berry==None:
berry=cberry.Cberry()
berry.turn_screen_on()
cert_exp=mumble_bot.get_cert_validity()
ip=mumble_bot.getIP()
berry.print_on_screen(online_users,ip,cert_exp)#update screen in any case
#write to display
if(one_user_online==False):#there aren't online users
berry.turn_screen_off()
berry=None
time.sleep(1)
if __name__ == '__main__':
main()