From fde26ec8de85c7e61aacadad497dceb341efd069 Mon Sep 17 00:00:00 2001 From: Alexandre Chataignon Date: Fri, 3 Mar 2017 06:37:11 +0100 Subject: [PATCH] Added setting to skip archive generation if archive file is already present --- sigal/gallery.py | 4 ++++ sigal/templates/sigal.conf.py | 1 + 2 files changed, 5 insertions(+) diff --git a/sigal/gallery.py b/sigal/gallery.py index 143b1ca..9a6064e 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -482,6 +482,10 @@ class Album(UnicodeMixin): if zip_gallery and len(self) > 0: archive_path = join(self.dst_path, zip_gallery) + if self.settings.get('zip_skip_if_exists', False) and isfile(archive_path): + self.logger.debug("Archive %s already created, passing", archive_path) + return zip_gallery + archive = zipfile.ZipFile(archive_path, 'w', allowZip64=True) attr = ('src_path' if self.settings['zip_media_format'] == 'orig' else 'dst_path') diff --git a/sigal/templates/sigal.conf.py b/sigal/templates/sigal.conf.py index 1ec4abb..30b4fb4 100644 --- a/sigal/templates/sigal.conf.py +++ b/sigal/templates/sigal.conf.py @@ -187,6 +187,7 @@ ignore_files = [] # contain all resized or original files (depending on `zip_media_format`). # zip_gallery = False # False or 'archive.zip' # zip_media_format = 'resized' # 'resized' or 'orig' +# zip_skip_if_exists = false # Skip archive generation if archive is already present. Warning: new photos in an album won't be added to archive # Specify a different locale. If set to '', the default locale is used. # locale = ''