-cleaned up some WTF!?!??! code

This commit is contained in:
Martin Konecny 2012-04-08 19:29:55 -04:00
parent d562a26f4b
commit b9e840552b
2 changed files with 10 additions and 14 deletions

View File

@ -135,18 +135,17 @@ class AirtimeMediaMonitorBootstrap():
for file_path in deleted_files_set:
self.logger.debug("deleted file")
full_file_path = "%s%s" % (dir, file_path)
full_file_path = os.path.join(dir, file_path)
self.logger.debug(full_file_path)
self.pe.handle_removed_file(False, full_file_path)
for file_path in new_files_set:
self.logger.debug("new file")
full_file_path = "%s%s" % (dir, file_path)
full_file_path = os.path.join(dir, file_path)
self.logger.debug(full_file_path)
if os.path.exists(full_file_path):
organized_filepath = self.pe.handle_created_file(False, full_file_path, os.path.basename(full_file_path))
if organized_filepath is not None:
self.pe.handle_created_file(False, organized_filepath, os.path.basename(organized_filepath))
self.pe.handle_created_file(False, full_file_path, os.path.basename(full_file_path))
for file_path in modified_files_set:
self.logger.debug("modified file")

View File

@ -137,15 +137,12 @@ 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
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):
is_recorded = True
else :
is_recorded = False
self.file_events.append({'mode': self.config.MODE_CREATE, 'filepath': pathname, 'is_recorded_show': is_recorded})
pathname = self.mmc.organize_new_file(pathname)
name = os.path.basename(pathname)
self.mmc.set_needed_file_permissions(pathname, dir)
is_recorded = self.mmc.is_parent_directory(pathname, self.config.recorded_directory)
self.file_events.append({'mode': self.config.MODE_CREATE, 'filepath': pathname, 'is_recorded_show': is_recorded})
else:
#event is because of a created directory