added watch

This commit is contained in:
Tyrel Souza 2016-02-26 11:26:29 -05:00
parent 3d4d53a881
commit 7a9e86a76c
1 changed files with 25 additions and 0 deletions

25
bin/watch.py Normal file
View File

@ -0,0 +1,25 @@
import time
import subprocess
from watchdog.observers import Observer
from watchdog.events import PatternMatchingEventHandler
class MyHandler(PatternMatchingEventHandler):
patterns=["*.png",]
def on_created(self, event):
print "yay"
subprocess.Popen(['/bin/bash', '/Users/tyrelsouza/bin/upload_and_copy', event.src_path])
if __name__ == '__main__':
observer = Observer()
observer.schedule(MyHandler(), path='/Users/tyrelsouza/screenshots/')
observer.start()
try:
while True:
time.sleep(0.1)
except KeyboardInterrupt:
observer.stop()
observer.join()