CC-2272: Ability to change storage directory location
make sure imported and organize dirs are created
This commit is contained in:
parent
6b9066466b
commit
75e9ecf985
2 changed files with 6 additions and 4 deletions
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue