forked from alfredholmes/TeXNotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontinuous_compile.py
More file actions
39 lines (24 loc) · 788 Bytes
/
continuous_compile.py
File metadata and controls
39 lines (24 loc) · 788 Bytes
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
import sys, time
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from manage import Helper
class Handler(FileSystemEventHandler):
def __init__(self, *args):
self.last_update_time = 0
super().__init__(*args)
def on_modified(self, event):
if time.time() - self.last_update_time > 5:
Helper.render_updates()
self.last_update_time = time.time()
if __name__ == "__main__":
path = 'notes/'
observer = Observer()
handler = Handler()
observer.schedule(handler, path, recursive=True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()