From d1dd6db9c7af3b7fd6168d60297ee385e2b5a6b8 Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Thu, 6 Mar 2014 09:28:03 +0200 Subject: [PATCH] thumb generation disable --- Qalbum.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Qalbum.py b/Qalbum.py index 96ff059..7c51aef 100755 --- a/Qalbum.py +++ b/Qalbum.py @@ -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,7 +428,8 @@ def traverse(path,crumbs,inputs,options): imagelist=getimagelist(path,options) if options.clean: cleanthumbs(path) - createthumbs(path,imagelist,options) + if options.thumbs: + createthumbs(path,imagelist,options) imagelist.extend(getnonconvertiblelist(path,options)) filelist=getnonimagelist(path,options) 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)") 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