diff --git a/sigal.py b/sigal.py index 7339d6e..8967bbf 100755 --- a/sigal.py +++ b/sigal.py @@ -46,6 +46,8 @@ def main(): parser.add_option("-c", "--copyright", dest="copyright", help="copyright message added to the images") + parser.add_option("-f", "--force", dest="force", + help="force the reprocessing of existing images and thumbnails") (options, args) = parser.parse_args() @@ -68,7 +70,7 @@ def main(): # create gallery gallery = Gallery(params) - gallery.build(input_dir, output_dir) + gallery.build(input_dir, output_dir, force=options.force) return 0 diff --git a/sigal/image.py b/sigal/image.py index c51fdd5..9fdc468 100644 --- a/sigal/image.py +++ b/sigal/image.py @@ -61,11 +61,12 @@ class Gallery: if len(imglist) != 0: yield dirpath, dirnames, imglist - def build(self, input_dir, output_dir): + def build(self, input_dir, output_dir, force=False): "create image gallery" self.input_dir = os.path.abspath(input_dir) self.output_dir = os.path.abspath(output_dir) + self.force = force if not os.path.isdir(self.output_dir): print "Create output directory %s" % self.output_dir @@ -106,7 +107,8 @@ class Gallery: im_name = os.path.join(img_dir, filename) thumb_name = os.path.join(thumb_dir, self.thumb_prefix+filename) - if os.path.isfile(im_name) and os.path.isfile(thumb_name): + if os.path.isfile(im_name) and os.path.isfile(thumb_name) and \ + not self.force: print "%s exists - skipping" % filename continue