-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (28 loc) · 847 Bytes
/
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
from handler import *
from setting import *
import watchdog.test_watchdog as watch
"""
main.py
put all things together
"""
if __name__ == '__main__':
setting.init()
filelist = open(f"files/filelist.blk", "w")
files = handler.gen_file_list()
for file in files:
filelist.write(f"{file.filename}"+"\n")
handler.gen_block_list(file)
event_handler1 = MyFileMonitor()
observer = Observer()
watch = observer.schedule(event_handler1, path='.', recursive=True)
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
observer.start()
try:
while True:
time.sleep(60)
handler.update()
except KeyboardInterrupt:
observer.stop()
observer.join()