CC-1799 : Live Studio Playout from media library (pytagsfs)
-code cleanup
This commit is contained in:
parent
2be05a8004
commit
3424dcc12d
3 changed files with 38 additions and 29 deletions
|
@ -52,6 +52,7 @@ try:
|
|||
logger.info("Storage Directory is: %s", storage_directory)
|
||||
config.storage_directory = storage_directory
|
||||
config.imported_directory = storage_directory + '/imported'
|
||||
config.organize_directory = storage_directory + '/organize'
|
||||
|
||||
multi_queue = mpQueue()
|
||||
logger.info("Initializing event processor")
|
||||
|
|
|
@ -220,18 +220,20 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
def handle_created_file(self, dir, name, pathname):
|
||||
self.logger.debug("dir: %s, name: %s, pathname: %s ", dir, name, pathname)
|
||||
storage_directory = self.config.storage_directory
|
||||
organize_directory = self.config.organize_directory
|
||||
if not dir:
|
||||
#event is because of a created file
|
||||
if self.is_temp_file(name) :
|
||||
#file created is a tmp file which will be modified and then moved back to the original filename.
|
||||
self.temp_files[pathname] = None
|
||||
elif self.is_audio_file(pathname):
|
||||
if self.is_parent_directory(pathname, storage_directory):
|
||||
#file was created in /srv/airtime/stor. Need to process and copy
|
||||
if self.is_parent_directory(pathname, organize_directory):
|
||||
#file was created in /srv/airtime/stor/organize. Need to process and copy
|
||||
#to /srv/airtime/stor/imported
|
||||
self.set_needed_file_permissions(pathname, dir)
|
||||
self.process_new_file(pathname)
|
||||
self.organize_new_file(pathname)
|
||||
else:
|
||||
self.set_needed_file_permissions(pathname, dir)
|
||||
self.file_events.append({'mode': self.config.MODE_CREATE, 'filepath': pathname, 'is_recorded_show': False})
|
||||
|
||||
else:
|
||||
|
@ -240,7 +242,7 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
self.set_needed_file_permissions(pathname, dir)
|
||||
|
||||
|
||||
def process_new_file(self, pathname):
|
||||
def organize_new_file(self, pathname):
|
||||
self.logger.info("Processing new file: %s", pathname)
|
||||
file_md = self.md_manager.get_md_from_file(pathname)
|
||||
|
||||
|
@ -377,6 +379,8 @@ class AirtimeProcessEvent(ProcessEvent):
|
|||
|
||||
self.file_events = []
|
||||
|
||||
#use items() because we are going to be modifying this
|
||||
#dictionary while iterating over it.
|
||||
for k, pair in self.cookies_IN_MOVED_FROM.items():
|
||||
event = pair[0]
|
||||
timestamp = pair[1]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue