Skip to content

Commit

Permalink
Enhance filesystem.process_file get_metadata cache performance. (#353)
Browse files Browse the repository at this point in the history
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 afacb96
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions elodie/filesystem.py
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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.