Commit 8ac85ff6 authored by Klaus-Uwe Mitterer's avatar Klaus-Uwe Mitterer

Drop basically unused queue

parent 812b5fc3
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment