| 43 | file.write('0\n清零\n计数:0\n{tm}') |
| 44 | |
| 45 | def 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 | |
| 60 | def main(): |
| 61 | # 检测程序是否已经在运行 |