-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhandler.py
35 lines (28 loc) · 842 Bytes
/
handler.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
import time
from watchdog.events import FileSystemEventHandler
from slingshot import Slingshot
from RemoteListener import RemoteListener
class EventHandler(FileSystemEventHandler):
@staticmethod
def on_created(event):
print "Created: " + event.src_path
EventHandler.push()
@staticmethod
def on_deleted(event):
print "Deleted: " + event.src_path
EventHandler.push()
@staticmethod
def on_modified(event):
print "Modified: " + event.src_path
EventHandler.push()
@staticmethod
def on_moved(event):
print "Moved: " + event.src_path
EventHandler.push()
@staticmethod
def push():
RemoteListener.stopRunning()
Slingshot.push_files()
RemoteListener.updateState()
time.sleep(1)
RemoteListener.watch()