diff --git a/Qalbum.py b/Qalbum.py index c936356..fa1ccd3 100755 --- a/Qalbum.py +++ b/Qalbum.py @@ -31,6 +31,7 @@ __version__='1.10' 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) vectorsearch=re.compile('.*\.svg$|.*\.pdf$',re.I) +nonconvertiblesearch=re.compile('.*\.html$|.*\.htm$|.*\.php$',re.I) #gifsearch=re.compile('.*gif$',re.I) excludepaths=re.compile('_med|_tn|\..*') doublequotes=re.compile('"') @@ -74,6 +75,22 @@ def getimagelist(path,options=False): imgs.sort() return imgs +def getnonconvertiblelist(path,options=False): + ''' Returns a list of files matching the nonconvertible regex ''' + list=os.listdir(path) + files=[] + for f in list: + if (nonconvertiblesearch.match(f)) and (os.path.isfile(os.path.join(path,f))) and not (webfilesearch.match(f)): + files.append(f) + if options: + if options.timesort: + files.sort(key=lambda f: os.path.getmtime(os.path.join(path, f)),reverse=options.reverse) + else: + files.sort(reverse=options.reverse) + else: + files.sort() + return files + def getfiletimes(path,list): ''' Returns a list of modification times ''' times=[] @@ -343,6 +360,8 @@ def traverse(path,crumbs,inputs,options): print('Depth: '+str(len(crumbs))) pathlist=getpathlist(path,options) imagelist=getimagelist(path,options) + createthumbs(path,imagelist,options) + imagelist.extend(getnonconvertiblelist(path,options)) filelist=getnonimagelist(path,options) print(str(len(pathlist))+' paths') print(str(len(imagelist))+' images') @@ -378,7 +397,7 @@ def traverse(path,crumbs,inputs,options): f.write('
') f.write(getfooter()) f.close() - createthumbs(path,imagelist,options) + for p in pathlist: nextcrumbs=[i for i in crumbs] nextcrumbs.append(os.path.join(path,p)) diff --git a/galleryscript.js b/galleryscript.js index a8db192..d1b9a5e 100644 --- a/galleryscript.js +++ b/galleryscript.js @@ -984,14 +984,22 @@ function showbigimage(i) { if (fullscreen) { height=height+200; } if (originals) { mediumstr=encodeURIComponent(imagelist[i]); } else { mediumstr='_med/med_'+encodeURIComponent(imagelist[i])+'.jpg'; } - $('#imagecontainer').html('
'+ + if (isHTML(imagelist[i])) { + $('#imagecontainer').html('
'+ + '