You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

19 lines
585 B

import os
from PIL import Image
from PIL.ImageOps import grayscale
from watchdog.events import RegexMatchingEventHandler
class FilesEventHandler(RegexMatchingEventHandler):
FILES_REGEX = [r".*[^_thumbnail]\.jpg$"]
socketio = None
def __init__(self,socketio):
self.socketio = socketio
super().__init__(self.FILES_REGEX)
def on_any_event(self, event):
print("File change occured")
filename, ext = os.path.splitext(event.src_path)
print("{}_socket".format(filename.split(".")[0]))
self.socketio.emit("new", "new", namespace="{}_socket".format(filename.split(".")[0]))