Skip to content
Permalink
Browse files

Enhance filesystem.process_file get_metadata cache performance. (#353)

Reduce exiftool calls by using a metadata object cache. 
Enable single exiftool subprocess to elimate spawing exiftool for each image.
  • Loading branch information
amaleki committed Feb 24, 2020
1 parent b07d26c commit afacb969e8d2108cef002bb75844dc009755d433
Showing with 3 additions and 3 deletions.
  1. +3 −3 elodie/filesystem.py
@@ -543,7 +543,7 @@ def process_file(self, _file, destination, media, **kwargs):
directory_name = self.get_folder_path(metadata)
dest_directory = os.path.join(destination, directory_name)
file_name = self.get_file_name(metadata)
dest_path = os.path.join(dest_directory, file_name)
dest_path = os.path.join(dest_directory, file_name)

media.set_original_name()

@@ -589,7 +589,7 @@ def process_file(self, _file, destination, media, **kwargs):
# before we made any changes.
# Then set the utime on the destination file based on metadata.
os.utime(_file, (stat_info_original.st_atime, stat_info_original.st_mtime))
self.set_utime_from_metadata(media.get_metadata(), dest_path)
self.set_utime_from_metadata(metadata, dest_path)

db = Db()
db.add_hash(checksum, dest_path)
@@ -642,4 +642,4 @@ def should_exclude(self, path, regex_list=set(), needs_compiled=False):
compiled_list.append(re.compile(regex))
regex_list = compiled_list

return any(regex.search(path) for regex in regex_list)
return any(regex.search(path) for regex in regex_list)

0 comments on commit afacb96

Please sign in to comment.
You can’t perform that action at this time.