|
|
|
|
@ -35,7 +35,7 @@ __license__ = "GPL"
|
|
|
|
|
|
|
|
|
|
import os |
|
|
|
|
import sys |
|
|
|
|
from optparse import OptionParser |
|
|
|
|
import argparse |
|
|
|
|
from sigal.image import Gallery |
|
|
|
|
from sigal.params import read_params |
|
|
|
|
from sigal.theme import Theme |
|
|
|
|
@ -43,41 +43,35 @@ from sigal.theme import Theme
|
|
|
|
|
def main(): |
|
|
|
|
"main program" |
|
|
|
|
|
|
|
|
|
# command line options |
|
|
|
|
usage = "usage: %prog [options] inputdir outputdir" |
|
|
|
|
version = "version %s, %s" % (__version__, __date__) |
|
|
|
|
|
|
|
|
|
parser = OptionParser(usage=usage, version="%prog "+version) |
|
|
|
|
parser = argparse.ArgumentParser(description='simple static gallery generator.') |
|
|
|
|
parser.add_argument('input_dir', help='input directory') |
|
|
|
|
parser.add_argument('output_dir', help='output directory') |
|
|
|
|
parser.add_argument('--version', action='version', |
|
|
|
|
version="%(prog)s " + version) |
|
|
|
|
parser.add_argument('-c', '--copyright', |
|
|
|
|
help="copyright message added to the images") |
|
|
|
|
parser.add_argument("-f", "--force", action='store_true', |
|
|
|
|
help="force the reprocessing of existing images and thumbnails") |
|
|
|
|
|
|
|
|
|
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") |
|
|
|
|
args = parser.parse_args() |
|
|
|
|
|
|
|
|
|
(options, args) = parser.parse_args() |
|
|
|
|
|
|
|
|
|
if len(args) != 2: |
|
|
|
|
parser.print_help() |
|
|
|
|
sys.exit() |
|
|
|
|
|
|
|
|
|
input_dir = args[0] |
|
|
|
|
output_dir = args[1] |
|
|
|
|
|
|
|
|
|
if not os.path.isdir(input_dir): |
|
|
|
|
print "Directory %s does not exist." % input_dir |
|
|
|
|
if not os.path.isdir(args.input_dir): |
|
|
|
|
print "Directory %s does not exist." % args.input_dir |
|
|
|
|
sys.exit(1) |
|
|
|
|
|
|
|
|
|
print ":: Reading parameters ..." |
|
|
|
|
params = read_params(input_dir) |
|
|
|
|
params = read_params(args.input_dir) |
|
|
|
|
|
|
|
|
|
if options.copyright: |
|
|
|
|
params.set('sigal', 'copyright', options.copyright) |
|
|
|
|
if args.copyright: |
|
|
|
|
params.set('sigal', 'copyright', args.copyright) |
|
|
|
|
|
|
|
|
|
# create gallery |
|
|
|
|
gallery = Gallery(params) |
|
|
|
|
gallery.build(input_dir, output_dir, force=options.force) |
|
|
|
|
gallery.build(args.input_dir, args.output_dir, force=args.force) |
|
|
|
|
|
|
|
|
|
r = Theme(params, output_dir) |
|
|
|
|
r = Theme(params, args.output_dir) |
|
|
|
|
r.render() |
|
|
|
|
|
|
|
|
|
return 0 |
|
|
|
|
|