diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py b/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py index 4ffffadd7..55973527c 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimenotifier.py @@ -100,6 +100,10 @@ class AirtimeNotifier(Notifier): self.config.storage_directory = new_storage_directory self.config.imported_directory = new_storage_directory + '/imported' self.config.organize_directory = new_storage_directory + '/organize' + + mm.ensure_is_dir(self.config.storage_directory) + mm.ensure_is_dir(self.config.imported_directory) + mm.ensure_is_dir(self.config.organize_directory) mm.watch_directory(new_storage_directory) diff --git a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py index 0e2820566..08689dd25 100644 --- a/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py +++ b/python_apps/media-monitor/airtimefilemonitor/airtimeprocessevent.py @@ -106,9 +106,7 @@ class AirtimeProcessEvent(ProcessEvent): #checks if path is a directory, and if it doesnt exist, then creates it. #Otherwise prints error to log file. - def ensure_is_dir(self, filepath): - directory = os.path.dirname(filepath) - + def ensure_is_dir(self, directory): try: omask = os.umask(0) if not os.path.exists(directory): @@ -213,7 +211,7 @@ class AirtimeProcessEvent(ProcessEvent): filepath = self.create_unique_filename(filepath, original_path) self.logger.info('Unique filepath: %s', filepath) - self.ensure_is_dir(filepath) + self.ensure_is_dir(os.path.dirname(filepath)) except Exception, e: self.logger.error('Exception: %s', e)