Drop basically unused queue

This commit is contained in:
Kumi 2018-08-18 12:24:25 +02:00
parent 812b5fc3b8
commit 8ac85ff627
1 changed files with 4 additions and 15 deletions

View File

@ -17,10 +17,8 @@ faildir = "upload/fail/"
logf = "[%(name)s] %(levelname)s: %(message)s"
logging.basicConfig(format=logf)
globq = multiprocessing.Queue()
class Worker(multiprocessing.Process):
def __init__(self, path, q):
def __init__(self, path):
super(Worker, self).__init__()
self.path = path
@ -31,9 +29,7 @@ class Worker(multiprocessing.Process):
self.string = io.StringIO()
self.logger = logging.getLogger("mp4conv")
self.handler = logging.StreamHandler(self.string)
self.queue = logging.handlers.QueueHandler(q)
self.logger.addHandler(self.handler)
self.logger.addHandler(self.queue)
self.logger.setLevel(logging.DEBUG)
def subprocess_logger(self, output):
@ -88,25 +84,18 @@ class Worker(multiprocessing.Process):
self.process()
class Handler(pyinotify.ProcessEvent):
def my_init(self, q):
self.logq = q
def process_IN_CLOSE_WRITE(self, event):
Worker(event.pathname, self.logq).start()
Worker(event.pathname).start()
def process_IN_MOVED_TO(self, event):
self.process_IN_CLOSE_WRITE(event)
def runner(q = globq):
def runner():
watch = pyinotify.WatchManager()
event = pyinotify.IN_CLOSE_WRITE | pyinotify.IN_MOVED_TO
#handler = logging.StreamHandler()
#listener = logging.handlers.QueueListener(q, handler)
#listener.start()
notifier = pyinotify.ThreadedNotifier(watch, Handler(q=q))
notifier = pyinotify.ThreadedNotifier(watch, Handler())
watch.add_watch(indir, event, rec=True)
notifier.start()