reorganize default params and move get_filelist to image.py
This commit is contained in:
6
sigal.py
6
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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user