# http://seb-m.github.io/pyinotify/
import pyinotify
watch_dir = '/home/ubuntu/Dropbox/controls'
class Identity(pyinotify.ProcessEvent):
def process_default(self, event):
print 'Does nothing.'
def on_loop(notifier):
s_inst = notifier.proc_fun().nested_pevent()
print repr(s_inst), '\n', s_inst, '\n'
wm = pyinotify.WatchManager()
s = pyinotify.Stats()
notifier = pyinotify.Notifier(wm, default_proc_fun=Identity(s), read_freq=5)
wm.add_watch(watch_dir, pyinotify.ALL_EVENTS, rec=True, auto_add=True)
notifier.loop(callback=on_loop)