Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache exiftool data in ExportDB to speed export with exiftool: template #325

Closed
narensankar0529 opened this issue Jan 3, 2021 · 4 comments
Labels
feature request New feature or request

Comments

@narensankar0529
Copy link

Not sure if this is expected, but if you use exif data as a filename template, then export slows down dramatically. Without using exif data, export of around 60,000 items takes around 15 minutes. With exif (for example using the camera make) in the filename, export takes almost 1.5 hours to the same USB-C SSD. In both cases the Photos database and the output are on the same APFS disk

@RhetTbull
Copy link
Owner

This is expected because exiftool must be used to read every single image file to gather the EXIF data for the template

@RhetTbull
Copy link
Owner

A small subset of the original image's exif data is imported by Photos into the database at import time. I added the following new templates which will read from the database, not from the file's actual exif. This should restore run time for this subset of exif data:

In release v0.39.5

  • {exif.camera_make}
  • {exif.camera_model}
  • {exif.lens_model}

@RhetTbull RhetTbull reopened this Jan 3, 2021
@RhetTbull
Copy link
Owner

Since original images do not change in the Photos library, it would be possible to cache the exiftool dictionary in the export db so that subsequent export sessions with --update do not have to re-run exiftool. exiftool would only need to read metadata for new images since the last update.

pseudo code:

add new 'exiftool' table to ExportDB (there's currently exifdata but that only stores the data used by --exiftool)
when using exiftool: template,
first, query exportdb for file in exiftool table
if found, use that data
else, run exiftool, store the full dictionary in 'exiftool' table, keyed by filename and use this info

If user did something to update exifdata in place (e.g. modified the original files in the Photos library), they would need to delete the export db and re-run --update to re-build the cache

@RhetTbull RhetTbull changed the title Dramatic slow-down in export when using exif data as templates Cache exiftool data in ExportDB to speed export with exiftool: template Jan 3, 2021
@RhetTbull RhetTbull added the feature request New feature or request label Jan 4, 2021
@RhetTbull
Copy link
Owner

@narensankar0529 In version v0.42.13 I've added caching for the exiftool data used in the {exiftool} template. This should speed things up considerably if you're using more than one exiftool field in your template strings. Of course, this will always be slower than not using {exiftool} since osxphotos will always have to call exiftool once per file to read the initial exif data. With this new change, the data will at least be cached so if you use more than one exiftool template, osxphotos won't have to call exiftool again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants