MCPcopy
hub / github.com/CHNZYX/Auto_Simulated_Universe / notify

Function notify

notif.py:45–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43 file.write('0\n清零\n计数:0\n{tm}')
44
45def notify():
46 file_name = 'logs/notif.txt'
47 if not os.path.exists(file_name):
48 with open(file_name, 'w', encoding="utf-8") as file:
49 file.write("0")
50 last = os.path.getmtime(file_name)
51 while 1:
52 time.sleep(0.5)
53 if last != os.path.getmtime(file_name):
54 with open(file_name,'r', encoding="utf-8",errors='ignore') as fh:
55 s=fh.readlines()
56 if len(s)>=3:
57 notif(s[1].strip('\n'),s[2].strip('\n'))
58 last = os.path.getmtime(file_name)
59
60def main():
61 # 检测程序是否已经在运行

Callers

nothing calls this directly

Calls 2

sleepMethod · 0.80
notifFunction · 0.70

Tested by

no test coverage detected