diff --git a/Qalbum.py b/Qalbum.py index 4dc08ed..db5d204 100755 --- a/Qalbum.py +++ b/Qalbum.py @@ -26,7 +26,7 @@ from datetime import datetime # (c) ville.rantanen@helsinki.fi -__version__='2.1' +__version__='2.2' webfilesearch=re.compile('.*index.html$|gallerystyle.css$|galleryscript.js$|descriptions.csv$|^info.txt$|\..*',re.I) imagesearch=re.compile('.*\.jpg$|.*\.jpeg$|.*\.gif$|.*\.png$|.*\.svg$|.*\.pdf$',re.I) @@ -412,6 +412,8 @@ def setupoptions(): parser.add_argument("--version",action='version', version=__version__) parser.add_argument("-r",action="store_true",dest="reverse",default=False, help="Reverse sort orded") + parser.add_argument("-s",type=str,dest="style", + help="User defined CSS style file.") parser.add_argument("-t",action="store_true",dest="timesort",default=False, help="Sort by file modification time") parser.add_argument("-a",action="store_false",dest="attachments",default=True, @@ -445,6 +447,8 @@ def setupdefaultoptions(options): options.recursive=True if 'reverse' not in options: options.reverse=False + if 'style' not in options or options.style is None: + 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 'width' not in options: @@ -458,7 +462,9 @@ def execute_plain(): # Copy all resources to target folder pathname=os.path.dirname(os.path.realpath(sys.argv[0])) fullpath=os.path.abspath(pathname) - shutil.copyfile(os.path.join(fullpath,'gallerystyle.css'),os.path.join(options.startpath,'gallerystyle.css')) + if not os.path.exists(options.style): + raise IOError('File not found: "'+options.style+'"') + shutil.copyfile(options.style,os.path.join(options.startpath,'gallerystyle.css')) shutil.copyfile(os.path.join(fullpath,'galleryscript.js'),os.path.join(options.startpath,'galleryscript.js')) inputs=[]