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.
This commit is contained in:
Arian Maleki 2020-02-24 15:46:02 -08:00 committed by GitHub
parent b07d26c389
commit afacb969e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -543,7 +543,7 @@ class FileSystem(object):
directory_name = self.get_folder_path(metadata) directory_name = self.get_folder_path(metadata)
dest_directory = os.path.join(destination, directory_name) dest_directory = os.path.join(destination, directory_name)
file_name = self.get_file_name(metadata) 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() media.set_original_name()
@ -589,7 +589,7 @@ class FileSystem(object):
# before we made any changes. # before we made any changes.
# Then set the utime on the destination file based on metadata. # Then set the utime on the destination file based on metadata.
os.utime(_file, (stat_info_original.st_atime, stat_info_original.st_mtime)) 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 = Db()
db.add_hash(checksum, dest_path) db.add_hash(checksum, dest_path)
@ -642,4 +642,4 @@ class FileSystem(object):
compiled_list.append(re.compile(regex)) compiled_list.append(re.compile(regex))
regex_list = compiled_list regex_list = compiled_list
return any(regex.search(path) for regex in regex_list) return any(regex.search(path) for regex in regex_list)