CC-2571 : Media Monitor Bootstrap

modifying files fix in bootstrap, fix functions to have parameters the same.
This commit is contained in:
Naomi Aro 2011-07-20 16:15:58 +02:00
parent c5c06eddc2
commit 216a166437
2 changed files with 6 additions and 6 deletions

View File

@ -125,11 +125,11 @@ class AirtimeMediaMonitorBootstrap():
for file_path in new_files_set:
file_path = "%s%s" % (dir, file_path)
if os.path.exists(file_path):
organized_filepath = self.pe.handle_created_file(False, os.path.basename(file_path), file_path)
organized_filepath = self.pe.handle_created_file(False, file_path, os.path.basename(file_path))
if organized_filepath is not None:
self.pe.handle_created_file(False, os.path.basename(organized_filepath), organized_filepath)
self.pe.handle_created_file(False, organized_filepath, os.path.basename(organized_filepath))
for file_path in modified_files_set:
file_path = "%s%s" % (dir, file_path)
if os.path.exists(file_path):
self.pe.handle_modified_file(False, os.path.basename(file_path), file_path)
self.pe.handle_modified_file(False, file_path, os.path.basename(file_path))

View File

@ -46,9 +46,9 @@ class AirtimeProcessEvent(ProcessEvent):
#event.name: filename
#event.pathname: pathname (str): Concatenation of 'path' and 'name'.
def process_IN_CREATE(self, event):
self.handle_created_file(event.dir, event.name, event.pathname)
self.handle_created_file(event.dir, event.pathname, event.name)
def handle_created_file(self, dir, name, pathname):
def handle_created_file(self, dir, pathname, name):
if not dir:
self.logger.debug("PROCESS_IN_CREATE: %s, name: %s, pathname: %s ", dir, name, pathname)
#event is because of a created file
@ -84,7 +84,7 @@ class AirtimeProcessEvent(ProcessEvent):
self.handle_modified_file(event.dir, event.pathname, event.name)
def handle_modified_file(self, dir, pathname, name):
if not dir and self.mmc.is_parent_directory(pathname, self.config.organize_directory):
if not dir and not self.mmc.is_parent_directory(pathname, self.config.organize_directory):
self.logger.info("Modified: %s", pathname)
if self.mmc.is_audio_file(name):
self.file_events.append({'filepath': pathname, 'mode': self.config.MODE_MODIFY})