thumb generation disable

This commit is contained in:
ville rantanen
2014-03-06 09:28:03 +02:00
parent 222170e54c
commit d1dd6db9c7

View File

@@ -22,7 +22,6 @@ import shutil
import csv
import subprocess
import string
import configobj
from math import ceil
from datetime import datetime
@@ -43,6 +42,7 @@ clean=boolean
force=boolean
gravity=string
link=boolean
thumbs=boolean
width=string""".split('\n')
CONFIGCOMMENTS="""
config values:
@@ -55,6 +55,7 @@ clean: Delete unused thumbnails
force: Force recreate thumbnails
gravity: ImageMagick option for creating thumbnails, e.g. North,East,Center
link: Medium sized images are symbolic links to original
thumbs: Build medium sized and thumbnail images.
width: Medium images longer axis in pixels
""".split('\n')
webfilesearch=re.compile('.*index.html$|gallerystyle.css$|galleryscript.js$|'+FILEDESC+'$|^'+FILEINFO+'$|\..*',re.I)
@@ -427,6 +428,7 @@ def traverse(path,crumbs,inputs,options):
imagelist=getimagelist(path,options)
if options.clean:
cleanthumbs(path)
if options.thumbs:
createthumbs(path,imagelist,options)
imagelist.extend(getnonconvertiblelist(path,options))
filelist=getnonimagelist(path,options)
@@ -489,6 +491,8 @@ def setupoptions():
help="ImageMagick gravity for cropping. (Default: %(default)s)")
parser.add_argument("-w",type=int,dest="width",default=850,
help="Medium image size (Default: %(default)s)")
parser.add_argument("--no-thumbs",action="store_false",dest="thumbs",default=True,
help="Disable thumbnail and medium generation. Build the indexes only.")
parser.add_argument("-p",type=str,dest="parent",
help="Add a ../[PARENT] link to point out from the gallery. If the string starts with http:// it is considered as a static URL, otherwise the relative parent path is assumed.")
parser.add_argument("startpath",type=str,action="store",default=os.path.abspath('.'),nargs='?',
@@ -524,6 +528,8 @@ def setupdefaultoptions(options):
options.style=os.path.join(os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0]))),'gallerystyle.css')
if 'timesort' not in options:
options.timesort=False
if 'thumbs' not in options:
options.thumbs=True
if 'width' not in options:
options.width=850
return options
@@ -531,6 +537,7 @@ def setupdefaultoptions(options):
def readconfig(options):
""" Set up the options via config file """
if os.path.exists(FILECONFIG):
import configobj
try:
cfg=configobj.ConfigObj(FILECONFIG, configspec=SAVEDCONFIG, unrepr=True)
except configobj.UnreprError as err:
@@ -545,7 +552,7 @@ def readconfig(options):
def writeconfig(options):
""" Write the options to config file """
import configobj
cfg=configobj.ConfigObj(configspec=SAVEDCONFIG, unrepr=True)
cfg.initial_comment=CONFIGCOMMENTS
cfg.filename=FILECONFIG