From 7a6fe49b5441312cb97dd636b769e00d4bd930a4 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 12 Apr 2011 23:46:34 +0200 Subject: [PATCH] reorganize default params and move get_filelist to image.py --- sigal.py | 6 +++--- sigal/image.py | 8 +++++++- sigal/params.py | 6 +++--- sigal/utils.py | 32 -------------------------------- 4 files changed, 13 insertions(+), 39 deletions(-) delete mode 100644 sigal/utils.py diff --git a/sigal.py b/sigal.py index 93c9b89..3234613 100755 --- a/sigal.py +++ b/sigal.py @@ -60,9 +60,9 @@ def main(): print "Directory %s does not exist." % input_dir sys.exit(1) - # if not os.path.isdir(output_dir): - # print "Create %s" % output_dir - # os.makedirs(output_dir) + if not os.path.isdir(output_dir): + print "Create %s" % output_dir + os.makedirs(output_dir) print ":: Reading parameters ..." params = read_params(input_dir) diff --git a/sigal/image.py b/sigal/image.py index e16e322..1d3a8af 100644 --- a/sigal/image.py +++ b/sigal/image.py @@ -25,7 +25,13 @@ Resize images, create thumbnails with some options (squared thumbs, ...). import os import Image import ImageDraw -from utils import get_filelist + + +def get_filelist(directory, extensions): + "get list of files of particular extensions" + filelist = [os.path.normcase(f) for f in os.listdir(directory)] + return [os.path.join(directory, f) for f in filelist \ + if os.path.splitext(f)[1] in extensions] class Gallery: diff --git a/sigal/params.py b/sigal/params.py index 2902889..d068121 100644 --- a/sigal/params.py +++ b/sigal/params.py @@ -28,13 +28,13 @@ CONFIGDEFAULTS = { 'img_size': '640x480', 'thumb_prefix': '', 'thumb_size': '150x112', + 'thumb_dir': "thumbnail", + 'square_thumb': 0, 'big_img': 1, - 'square_thumb': 1, + 'bigimg_dir': "pwg_high", 'jpg_quality': 90, 'exif': 1, 'copyright': '', - 'thumb_dir': "thumbnail", - 'bigimg_dir': "pwg_high", 'fileExtList': ".jpg,.jpeg,.JPG,.JPEG,.png" } diff --git a/sigal/utils.py b/sigal/utils.py deleted file mode 100644 index 52f3385..0000000 --- a/sigal/utils.py +++ /dev/null @@ -1,32 +0,0 @@ -#! /usr/bin/env python2 -# -*- coding:utf-8 -*- - -# sigal - Piwigo gallery generator -# Copyright (C) 2009-2011 Simon - saimon.org -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; If not, see http://www.gnu.org/licenses/ - -"""Various stuff. - -- Fonctions used to manage files (get_filelist). -""" - -import os - -def get_filelist(directory, extensions): - "get list of files of particular extensions" - filelist = [os.path.normcase(f) for f in os.listdir(directory)] - return [os.path.join(directory, f) for f in filelist \ - if os.path.splitext(f)[1] in extensions] -