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
|
@ -101,6 +101,10 @@ class AirtimeNotifier(Notifier):
|
||||||
self.config.imported_directory = new_storage_directory + '/imported'
|
self.config.imported_directory = new_storage_directory + '/imported'
|
||||||
self.config.organize_directory = new_storage_directory + '/organize'
|
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)
|
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.
|
#checks if path is a directory, and if it doesnt exist, then creates it.
|
||||||
#Otherwise prints error to log file.
|
#Otherwise prints error to log file.
|
||||||
def ensure_is_dir(self, filepath):
|
def ensure_is_dir(self, directory):
|
||||||
directory = os.path.dirname(filepath)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
omask = os.umask(0)
|
omask = os.umask(0)
|
||||||
if not os.path.exists(directory):
|
if not os.path.exists(directory):
|
||||||
|
@ -213,7 +211,7 @@ class AirtimeProcessEvent(ProcessEvent):
|
||||||
|
|
||||||
filepath = self.create_unique_filename(filepath, original_path)
|
filepath = self.create_unique_filename(filepath, original_path)
|
||||||
self.logger.info('Unique filepath: %s', filepath)
|
self.logger.info('Unique filepath: %s', filepath)
|
||||||
self.ensure_is_dir(filepath)
|
self.ensure_is_dir(os.path.dirname(filepath))
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logger.error('Exception: %s', e)
|
self.logger.error('Exception: %s', e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue