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

plugin to cache the exif data of images #236

Merged
merged 1 commit into from Feb 5, 2017

Conversation

@t-animal
Copy link
Contributor

@t-animal t-animal commented Jan 27, 2017

Decreases the time needed to build large galleries (e.g.: 25k images in 2.5s instead of 30s)

This plugin allows extended caching, which is useful for large galleries. Once a gallery has
been built it caches the exif-data of the contained images in the gallery target folder.
Before the next run it restores them so that the image does not have to be parsed again. For
large galleries this can speed up the creation of index files dramatically.

@saimn
saimn approved these changes Feb 1, 2017
Copy link
Owner

@saimn saimn left a comment

Looks good, and nice improvement !

logger.debug("Loaded cache with %d entries", len(gallery.exifCache))
else:
gallery.exifCache = {}
except Exception as e:

This comment has been minimized.

@saimn

saimn Feb 1, 2017
Owner

Maybe move this try/except around the pickle.load line ?

This comment has been minimized.

@t-animal

t-animal Feb 2, 2017
Author Contributor

This is intended, as the file might exist but not be readable for the user.

if hasattr(gallery, "exifCache"):
cache = gallery.exifCache
else:
cache = gallery.exifCache = {}

This comment has been minimized.

@saimn

saimn Feb 1, 2017
Owner

Could be simplified with getattr(gallery, "exifCache", {}) and always use cache below.

This comment has been minimized.

@t-animal

t-animal Feb 2, 2017
Author Contributor

mhm, I would have to change the test cases, as they assume gallery.exifCache exists...

@saimn
Copy link
Owner

@saimn saimn commented Feb 1, 2017

@t-animal - Can you rebase on master to get rid of the conflict on tests/sample/sigal.conf.py ?

cache = album.gallery.exifCache

for media in album.medias:
if media.type == "image":

This comment has been minimized.

@saimn

saimn Feb 1, 2017
Owner

Forgot this, you can use album.images.

This comment has been minimized.

@t-animal

t-animal Feb 2, 2017
Author Contributor

fixed

@saimn
Copy link
Owner

@saimn saimn commented Feb 1, 2017

It would also be useful to add your plugins to the related documentation page, with a quick description: http://sigal.saimon.org/en/latest/plugins.html

@krylovsk
Copy link

@krylovsk krylovsk commented Feb 2, 2017

This is neat, I've been experiencing long rebuild times with my moderate (~5k) gallery.
Documentation would be welcome.

@t-animal t-animal force-pushed the t-animal:extended_caching_plugin branch 2 times, most recently from d5d5790 to 56c4aae Feb 2, 2017
@t-animal
Copy link
Contributor Author

@t-animal t-animal commented Feb 2, 2017

@krylovsk simply include the plugin in your config (plugins=['sigal.plugins.extended_caching']) and after you've build the gallery the next time, a cache-file will be put in your gallery from where the cached data will be loaded upon the build after that.

@t-animal t-animal force-pushed the t-animal:extended_caching_plugin branch from 56c4aae to 825e1da Feb 2, 2017
@saimn saimn merged commit e246646 into saimn:master Feb 5, 2017
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@saimn
Copy link
Owner

@saimn saimn commented Feb 5, 2017

Merging, thanks @t-animal !

@saimn saimn added this to the 1.4.0 milestone Feb 5, 2017
kontza pushed a commit to kontza/sigal that referenced this pull request Aug 28, 2020
plugin to cache the exif data of images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants