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 csv
import subprocess import subprocess
import string import string
import configobj
from math import ceil from math import ceil
from datetime import datetime from datetime import datetime
@@ -43,6 +42,7 @@ clean=boolean
force=boolean force=boolean
gravity=string gravity=string
link=boolean link=boolean
thumbs=boolean
width=string""".split('\n') width=string""".split('\n')
CONFIGCOMMENTS=""" CONFIGCOMMENTS="""
config values: config values:
@@ -55,6 +55,7 @@ clean: Delete unused thumbnails
force: Force recreate thumbnails force: Force recreate thumbnails
gravity: ImageMagick option for creating thumbnails, e.g. North,East,Center gravity: ImageMagick option for creating thumbnails, e.g. North,East,Center
link: Medium sized images are symbolic links to original link: Medium sized images are symbolic links to original
thumbs: Build medium sized and thumbnail images.
width: Medium images longer axis in pixels width: Medium images longer axis in pixels
""".split('\n') """.split('\n')
webfilesearch=re.compile('.*index.html$|gallerystyle.css$|galleryscript.js$|'+FILEDESC+'$|^'+FILEINFO+'$|\..*',re.I) webfilesearch=re.compile('.*index.html$|gallerystyle.css$|galleryscript.js$|'+FILEDESC+'$|^'+FILEINFO+'$|\..*',re.I)
@@ -427,7 +428,8 @@ def traverse(path,crumbs,inputs,options):
imagelist=getimagelist(path,options) imagelist=getimagelist(path,options)
if options.clean: if options.clean:
cleanthumbs(path) cleanthumbs(path)
createthumbs(path,imagelist,options) if options.thumbs:
createthumbs(path,imagelist,options)
imagelist.extend(getnonconvertiblelist(path,options)) imagelist.extend(getnonconvertiblelist(path,options))
filelist=getnonimagelist(path,options) filelist=getnonimagelist(path,options)
print(str(len(pathlist))+' paths, '+str(len(imagelist))+' images, '+str(len(filelist))+' other files') print(str(len(pathlist))+' paths, '+str(len(imagelist))+' images, '+str(len(filelist))+' other files')
@@ -489,6 +491,8 @@ def setupoptions():
help="ImageMagick gravity for cropping. (Default: %(default)s)") help="ImageMagick gravity for cropping. (Default: %(default)s)")
parser.add_argument("-w",type=int,dest="width",default=850, parser.add_argument("-w",type=int,dest="width",default=850,
help="Medium image size (Default: %(default)s)") 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", 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.") 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='?', 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') options.style=os.path.join(os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0]))),'gallerystyle.css')
if 'timesort' not in options: if 'timesort' not in options:
options.timesort=False options.timesort=False
if 'thumbs' not in options:
options.thumbs=True
if 'width' not in options: if 'width' not in options:
options.width=850 options.width=850
return options return options
@@ -531,6 +537,7 @@ def setupdefaultoptions(options):
def readconfig(options): def readconfig(options):
""" Set up the options via config file """ """ Set up the options via config file """
if os.path.exists(FILECONFIG): if os.path.exists(FILECONFIG):
import configobj
try: try:
cfg=configobj.ConfigObj(FILECONFIG, configspec=SAVEDCONFIG, unrepr=True) cfg=configobj.ConfigObj(FILECONFIG, configspec=SAVEDCONFIG, unrepr=True)
except configobj.UnreprError as err: except configobj.UnreprError as err:
@@ -545,7 +552,7 @@ def readconfig(options):
def writeconfig(options): def writeconfig(options):
""" Write the options to config file """ """ Write the options to config file """
import configobj
cfg=configobj.ConfigObj(configspec=SAVEDCONFIG, unrepr=True) cfg=configobj.ConfigObj(configspec=SAVEDCONFIG, unrepr=True)
cfg.initial_comment=CONFIGCOMMENTS cfg.initial_comment=CONFIGCOMMENTS
cfg.filename=FILECONFIG cfg.filename=FILECONFIG