rename params to settings
This commit is contained in:
@@ -36,7 +36,7 @@ import os
|
||||
import sys
|
||||
import argparse
|
||||
from sigal.image import Gallery
|
||||
from sigal.params import read_params
|
||||
from sigal.settings import read_settings
|
||||
from sigal.theme import Theme
|
||||
|
||||
def main():
|
||||
@@ -58,15 +58,15 @@ def main():
|
||||
print "Directory %s does not exist." % args.input_dir
|
||||
sys.exit(1)
|
||||
|
||||
print ":: Reading parameters ..."
|
||||
params = read_params(args.input_dir)
|
||||
print ":: Reading settings ..."
|
||||
settings = read_settings(args.input_dir)
|
||||
|
||||
if args.copyright:
|
||||
params.set('sigal', 'copyright', args.copyright)
|
||||
settings.set('sigal', 'copyright', args.copyright)
|
||||
|
||||
# create gallery
|
||||
gallery = Gallery(params)
|
||||
gallery = Gallery(settings)
|
||||
gallery.build(args.input_dir, args.output_dir, force=args.force)
|
||||
|
||||
r = Theme(params, args.output_dir)
|
||||
r = Theme(settings, args.output_dir)
|
||||
r.render()
|
||||
|
||||
@@ -32,20 +32,20 @@ DESCRIPTION_FILE = "album_description"
|
||||
class Gallery:
|
||||
"Prepare images"
|
||||
|
||||
def __init__(self, params):
|
||||
self.imsize = self.getsize(params.get('sigal', 'img_size'))
|
||||
self.bigimg = params.getint('sigal', 'big_img')
|
||||
self.bigimg_dir = params.get('sigal', 'bigimg_dir')
|
||||
def __init__(self, settings):
|
||||
self.imsize = self.getsize(settings.get('sigal', 'img_size'))
|
||||
self.bigimg = settings.getint('sigal', 'big_img')
|
||||
self.bigimg_dir = settings.get('sigal', 'bigimg_dir')
|
||||
|
||||
self.thumb_size = self.getsize(params.get('sigal', 'thumb_size'))
|
||||
self.thumb_dir = params.get('sigal', 'thumb_dir')
|
||||
self.thumb_prefix = params.get('sigal', 'thumb_prefix')
|
||||
self.square_thumb = params.getint('sigal', 'square_thumb')
|
||||
self.thumb_size = self.getsize(settings.get('sigal', 'thumb_size'))
|
||||
self.thumb_dir = settings.get('sigal', 'thumb_dir')
|
||||
self.thumb_prefix = settings.get('sigal', 'thumb_prefix')
|
||||
self.square_thumb = settings.getint('sigal', 'square_thumb')
|
||||
|
||||
self.jpgquality = params.getint('sigal', 'jpg_quality')
|
||||
self.exif = params.getint('sigal', 'exif')
|
||||
self.copyright = params.get('sigal', 'copyright')
|
||||
self.fileExtList = params.get('sigal', 'fileExtList').split(',')
|
||||
self.jpgquality = settings.getint('sigal', 'jpg_quality')
|
||||
self.exif = settings.getint('sigal', 'exif')
|
||||
self.copyright = settings.get('sigal', 'copyright')
|
||||
self.fileExtList = settings.get('sigal', 'fileExtList').split(',')
|
||||
|
||||
def getsize(self, string):
|
||||
"split size string to a tuple of int"
|
||||
|
||||
@@ -37,8 +37,8 @@ _DEFAULT_CONFIG = {
|
||||
}
|
||||
|
||||
|
||||
def read_params(source_dir):
|
||||
"Read params from a config file in the source_dir root"
|
||||
def read_settings(source_dir):
|
||||
"Read settings from a config file in the source_dir root"
|
||||
|
||||
# Read configuration file
|
||||
config = ConfigParser.ConfigParser(defaults=_DEFAULT_CONFIG)
|
||||
@@ -44,17 +44,17 @@ def do_link(link, title):
|
||||
class Theme():
|
||||
""" Generate html pages for each directory of images """
|
||||
|
||||
def __init__(self, params, path, theme=DEFAULT_THEME, tpl=INDEX_PAGE):
|
||||
def __init__(self, settings, path, theme=DEFAULT_THEME, tpl=INDEX_PAGE):
|
||||
self.data = {}
|
||||
self.path = os.path.normpath(path)
|
||||
self.bigimg = params.getint('sigal', 'big_img')
|
||||
self.bigimg_dir = params.get('sigal', 'bigimg_dir')
|
||||
self.thumb_dir = params.get('sigal', 'thumb_dir')
|
||||
self.thumb_prefix = params.get('sigal', 'thumb_prefix')
|
||||
self.fileExtList = params.get('sigal', 'fileExtList').split(',')
|
||||
self.bigimg = settings.getint('sigal', 'big_img')
|
||||
self.bigimg_dir = settings.get('sigal', 'bigimg_dir')
|
||||
self.thumb_dir = settings.get('sigal', 'thumb_dir')
|
||||
self.thumb_prefix = settings.get('sigal', 'thumb_prefix')
|
||||
self.fileExtList = settings.get('sigal', 'fileExtList').split(',')
|
||||
|
||||
if params.has_option('sigal', 'theme'):
|
||||
theme = params.get('sigal', 'theme')
|
||||
if settings.has_option('sigal', 'theme'):
|
||||
theme = settings.get('sigal', 'theme')
|
||||
|
||||
self.theme_path = os.path.join(THEMES_PATH, theme)
|
||||
self.theme_rel_path = os.path.relpath(self.theme_path, os.path.dirname(__file__))
|
||||
|
||||
Reference in New Issue
Block a user