diff --git a/Qalbum.py b/Qalbum.py index 640a307..f256061 100755 --- a/Qalbum.py +++ b/Qalbum.py @@ -310,12 +310,12 @@ def getdescriptions(path,list): desc[i]=stripquotes.sub('',row[1]) return desc -def getinfo(path): +def getinfo(path,options): ''' Read info.txt file and returns the content. Missing info file returns empty string. ''' - if not os.path.exists(os.path.join(path,'info.txt')): + if not os.path.exists(os.path.join(path,options.infofile)): return '' - reader = open(os.path.join(path,'info.txt'),'r') + reader = open(os.path.join(path,options.infofile),'r') return unicode(reader.read(),encoding="utf8",errors="ignore").encode('ascii','xmlcharrefreplace') def crumblinks(crumbs,title,parent): @@ -410,7 +410,7 @@ def traverse(path,crumbs,inputs,options): f.write(filejs) f.write(crumbstring) f.write(pathstring) - f.write('
'+getinfo(path)+'
') + f.write('
'+getinfo(path,options)+'
') f.write('
') f.write(imagestring) f.write(filestring) @@ -440,6 +440,8 @@ def setupoptions(): help="Sort by file modification time") parser.add_argument("-a",action="store_false",dest="attachments",default=True, help="Disable attachments") + parser.add_argument("-i",type=str,dest="infofile",default="info.txt", + help="File name for info files in all folders. (Default: %(default)s)") parser.add_argument("-g",type=str,dest="gallery",default="Gallery", help="Name for the root gallery (Default: %(default)s)") parser.add_argument("-w",type=int,dest="width",default=850, @@ -461,6 +463,8 @@ def setupdefaultoptions(options): options.clean=False if 'force' not in options: options.force=False + if 'infofile' not in options: + options.infofile="info.txt" if 'gallery' not in options: options.gallery="Gallery" if 'link' not in options: