including HTML as images. creates an IFRAME for them..
This commit is contained in:
21
Qalbum.py
21
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('<div id="listcontainer"></div>')
|
||||
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))
|
||||
|
||||
Reference in New Issue
Block a user