From afacb969e8d2108cef002bb75844dc009755d433 Mon Sep 17 00:00:00 2001 From: Arian Maleki Date: Mon, 24 Feb 2020 15:46:02 -0800 Subject: [PATCH] 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. --- elodie/filesystem.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/elodie/filesystem.py b/elodie/filesystem.py index b585eb0..92d7807 100644 --- a/elodie/filesystem.py +++ b/elodie/filesystem.py @@ -543,7 +543,7 @@ class FileSystem(object): 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 @@ class FileSystem(object): # 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 @@ class FileSystem(object): compiled_list.append(re.compile(regex)) regex_list = compiled_list - return any(regex.search(path) for regex in regex_list) \ No newline at end of file + return any(regex.search(path) for regex in regex_list)