From c5c06eddc20c0b62543b8f2764847c1ac0573f9c Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Wed, 20 Jul 2011 14:38:32 +0200 Subject: [PATCH] CC-2571 : Media Monitor Bootstrap making sure files added to the organize folder while media monitor is down are imported to Airtime when it is started up again. --- .../airtimefilemonitor/airtimemediamonitorbootstrap.py | 7 +++++-- .../airtimefilemonitor/airtimeprocessevent.py | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimemediamonitorbootstrap.py b/python_apps/media-monitor/airtimefilemonitor/airtimemediamonitorbootstrap.py index 1e7c89c9b..c72bbbd50 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimemediamonitorbootstrap.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimemediamonitorbootstrap.py @@ -72,6 +72,7 @@ class AirtimeMediaMonitorBootstrap(): db_known_files_set.add(file) new_files = self.mmc.scan_dir_for_new_files(dir) + all_files_set = set() for file_path in new_files: if len(file_path.strip(" \n")) > 0: @@ -107,7 +108,7 @@ class AirtimeMediaMonitorBootstrap(): #NAOMI: Please comment out the "Known files" line, if you find the bug. #it is for debugging purposes only (Too much data will be written to log). -mk - self.logger.info("Known files: \n%s\n\n"%db_known_files_set) + #self.logger.info("Known files: \n%s\n\n"%db_known_files_set) self.logger.info("Deleted files: \n%s\n\n"%deleted_files_set) self.logger.info("New files: \n%s\n\n"%new_files_set) self.logger.info("Modified files: \n%s\n\n"%modified_files_set) @@ -124,7 +125,9 @@ class AirtimeMediaMonitorBootstrap(): for file_path in new_files_set: file_path = "%s%s" % (dir, file_path) if os.path.exists(file_path): - self.pe.handle_created_file(False, os.path.basename(file_path), file_path) + organized_filepath = self.pe.handle_created_file(False, os.path.basename(file_path), file_path) + if organized_filepath is not None: + self.pe.handle_created_file(False, os.path.basename(organized_filepath), organized_filepath) for file_path in modified_files_set: file_path = "%s%s" % (dir, file_path) diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py index 704b1abc6..c14a8ee5b 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py @@ -64,7 +64,8 @@ class AirtimeProcessEvent(ProcessEvent): if self.mmc.is_parent_directory(pathname, self.config.organize_directory): #file was created in /srv/airtime/stor/organize. Need to process and move #to /srv/airtime/stor/imported - self.mmc.organize_new_file(pathname) + new_filepath = self.mmc.organize_new_file(pathname) + return new_filepath else: self.mmc.set_needed_file_permissions(pathname, dir) if self.mmc.is_parent_directory(pathname, self.config.recorded_directory):