From 6972150b19d018c9edcd963ee1a1779629abf2e0 Mon Sep 17 00:00:00 2001 From: martin Date: Tue, 12 Jul 2011 16:10:54 -0400 Subject: [PATCH] -fixed bug with moving from stor to stor/organize, and having duplicate files appear. --- .../airtimefilemonitor/airtimeprocessevent.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py index 0054be1f2..864df358f 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py @@ -293,7 +293,10 @@ class AirtimeProcessEvent(ProcessEvent): self.logger.debug(u"Moving from %s to %s", pathname, filepath) self.move_file(pathname, filepath) else: - self.logger.warn("File %s, has invalid metadata", pathname) + filepath = None + self.logger.warn("File %s, has invalid metadata", pathname) + + return filepath def process_IN_MODIFY(self, event): self.logger.info("process_IN_MODIFY: %s", event) @@ -332,9 +335,12 @@ class AirtimeProcessEvent(ProcessEvent): #files original location was also in a watched directory del self.cookies_IN_MOVED_FROM[event.cookie] if self.is_parent_directory(event.pathname, self.config.organize_directory): - self.organize_new_file(event.pathname) + filepath = self.organize_new_file(event.pathname) else: - self.file_events.append({'filepath': event.pathname, 'mode': self.config.MODE_MOVED}) + filepath = event.pathname + + if (filepath is not None): + self.file_events.append({'filepath': filepath, 'mode': self.config.MODE_MOVED}) else: if self.is_parent_directory(event.pathname, self.config.organize_directory): self.organize_new_file(event.pathname)