Qnano2 executable to create nanogallery2 albums

This commit is contained in:
ville rantanen
2018-08-27 22:37:43 +03:00
parent 8d6237bf3c
commit 9e043d92a8
5 changed files with 371 additions and 16 deletions

View File

@@ -14,7 +14,11 @@ ex.
`pip install --user --upgrade https://bitbucket.org/MoonQ/qalbum/get/tip.tar.gz` `pip install --user --upgrade https://bitbucket.org/MoonQ/qalbum/get/tip.tar.gz`
## Usage
Use the command line tool `Qalbum` to render web sites.
Alternatively, use `Qnano2` to create a site powered with [nanogallery2](https://nanogallery2.nanostudio.org/).
---- ----
The development of this software has received funding from the European Community's Seventh Framework Programme FP7/2007-2011 under grant agreement no. 201837. The development of this software has received funding from the European Community's Seventh Framework Programme FP7/2007-2011 under grant agreement no. 201837.

View File

@@ -27,9 +27,9 @@ from datetime import datetime
# (c) ville.q.rantanen@gmail.com # (c) ville.q.rantanen@gmail.com
__version__='2.20180731' __version__='2.20180827'
FILECONFIG=".config" FILECONFIG=".qalbum.config"
FILEDESC="descriptions.csv" FILEDESC="descriptions.csv"
FILEINFO="info.txt" FILEINFO="info.txt"
SAVEDCONFIG="""attachments=boolean SAVEDCONFIG="""attachments=boolean
@@ -53,10 +53,10 @@ reverse: Sort reverse
timesort: Sort by timestamp timesort: Sort by timestamp
clean: Delete unused thumbnails clean: Delete unused thumbnails
force: Force recreate thumbnails force: Force recreate thumbnails
gravity: ImageMagick option for creating thumbnails, e.g. North,East,Center gravity: ImageMagick option for creating thumbnails, e.g. North,East,Center
link: Medium sized images are symbolic links to original link: Medium sized images are symbolic links to original
thumbs: Build medium sized and thumbnail images. thumbs: Build medium sized and thumbnail images.
width: Medium images longer axis in pixels width: Medium images longer axis in pixels
""".split('\n') """.split('\n')
MISSINGICON="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAABaCAYAAAA4qEECAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4AYPCiUhpL4RuwAAABl0RVh0Q29tbWVudABDc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N/f/8PjlWpcOjQIRw9ehROpxO3b98OT4x2SZLeSVu5UyGa0QK23+/HrVu3EGsntoLR0VEEAqs5JzMFbIfDMWWxWAYAnF6ZII/Hg66uLsiyjOLi4pgH9ETR3t6OoaEN3/nQ6/VYWFgAERFj7OeSJP0r4ZBPxhiHw9FnNpsB4CerR8RQCAMDA7h//z7cbjd27twJg8GQVJMpFArh7t27K8llfWNVKqhUKni93kuSJF1PKrclO/MOh6PTbDa/hjUtfCLC+Pg4Hjx4gPb2djx79gxzc3PgeR48z0OtVq/bNhwbG0NfX19C+rVabSgvL6/BbrcvJmN3qh1vJgjC7wB8mugYjDHo9frVJvD8/Dy8Xu+qF/V6PYqKiqBSJTT3v2lubv5TWs6jcUCSJF1ijDUoSSH+A0RYWFjA5OQkJicnV2JtVe71euFyuda2B9fDqWQN3tS2RulP1mL5g4pNIxgMYmJiIm6sAjgiiqIma0SV/fB3kiS9Q0TvAehNB9kXL17EDVWNRvPjrBJdgc1mayspKalmjL1PRF8CmE1hmFki+pLjuKsJxLwpG8kokQ1Gyp/IXb58+RjHcV1xiJ5uampKuLWfscKPcmz6SvmFF934sOLbeu9LXbw4JaKpZOzJeoVrI4Jh3sqJQ/Spz+freikxmk4Q0WKcifh9sh9EblWiExuIf9vU1PRFVt+jmYLP53MC+MfaqiYR/ay5ufkPKW3lsEVx5cqVnEAg8C6A12RZ/sbv9z8QRXEJ29gY/wHGC3um9s1G8gAAAABJRU5ErkJggg=="
@@ -160,7 +160,7 @@ def getnonimagelist(path,options):
else: else:
files.sort(reverse=options.reverse,key=lambda x: natural_sort_key(x)) files.sort(reverse=options.reverse,key=lambda x: natural_sort_key(x))
return files return files
def getpathlist(path,options=False): def getpathlist(path,options=False):
''' Returns a list of subfolders not matching the exclusion regex ''' ''' Returns a list of subfolders not matching the exclusion regex '''
list=os.listdir(path) list=os.listdir(path)
@@ -304,7 +304,7 @@ def clearfolder(path,tnpath,regex):
list=getimagelist(tnpath) list=getimagelist(tnpath)
for i in list: for i in list:
f=regex.match(i) f=regex.match(i)
try: try:
if not os.path.exists(os.path.join(path,f.group(1))): if not os.path.exists(os.path.join(path,f.group(1))):
print('removing '+i) print('removing '+i)
os.remove(os.path.join(tnpath,i)) os.remove(os.path.join(tnpath,i))
@@ -384,7 +384,7 @@ def getinfo(path,options):
Missing info file returns empty string. ''' Missing info file returns empty string. '''
if not os.path.exists(os.path.join(path,options.infofile)): if not os.path.exists(os.path.join(path,options.infofile)):
return '' return ''
reader = open(os.path.join(path,options.infofile),'r') reader = open(os.path.join(path,options.infofile),'r')
return unicode(reader.read(),encoding="utf8",errors="ignore").encode('ascii','xmlcharrefreplace') return unicode(reader.read(),encoding="utf8",errors="ignore").encode('ascii','xmlcharrefreplace')
def crumblinks(crumbs,title,parent): def crumblinks(crumbs,title,parent):
@@ -431,7 +431,7 @@ def sizestring(size):
def natural_sort_key(s, _nsre=re.compile('([0-9]+)')): def natural_sort_key(s, _nsre=re.compile('([0-9]+)')):
''' Natural sort / Claudiu@Stackoverflow ''' ''' Natural sort / Claudiu@Stackoverflow '''
return [int(text) if text.isdigit() else text.lower() return [int(text) if text.isdigit() else text.lower()
for text in re.split(_nsre, s)] for text in re.split(_nsre, s)]
def which(program): def which(program):
''' emulate shell which command ''' ''' emulate shell which command '''
@@ -452,7 +452,7 @@ def which(program):
def traverse(path,crumbs,inputs,options): def traverse(path,crumbs,inputs,options):
''' The recursive main function to create the index.html and seek sub folders ''' ''' The recursive main function to create the index.html and seek sub folders '''
print(path) print(path)
if (not options.recurselink) and (os.path.islink(path)): if (not options.recurselink) and (os.path.islink(path)):
print('Not recursing, is a link') print('Not recursing, is a link')
@@ -496,7 +496,7 @@ def traverse(path,crumbs,inputs,options):
f.write('<div id="listcontainer"></div>') f.write('<div id="listcontainer"></div>')
f.write(getfooter()) f.write(getfooter())
f.close() f.close()
for p in pathlist: for p in pathlist:
nextcrumbs=[i for i in crumbs] nextcrumbs=[i for i in crumbs]
nextcrumbs.append(os.path.join(path,p)) nextcrumbs.append(os.path.join(path,p))
@@ -505,7 +505,7 @@ def traverse(path,crumbs,inputs,options):
def setupoptions(): def setupoptions():
''' Setup the command line options ''' ''' Setup the command line options '''
from argparse import ArgumentParser from argparse import ArgumentParser
parser=ArgumentParser() parser=ArgumentParser()
parser.add_argument("-v",action='version', version=__version__) parser.add_argument("-v",action='version', version=__version__)
parser.add_argument("--version",action='version', version=__version__) parser.add_argument("--version",action='version', version=__version__)
@@ -540,8 +540,8 @@ def setupoptions():
options=parser.parse_args() options=parser.parse_args()
options.startpath=os.path.abspath(options.startpath) options.startpath=os.path.abspath(options.startpath)
options=setupdefaultoptions(options) options=setupdefaultoptions(options)
return options return options
def setupdefaultoptions(options): def setupdefaultoptions(options):
''' Adds the missing options for the options object ''' ''' Adds the missing options for the options object '''
if not which('convert'): if not which('convert'):
@@ -590,7 +590,7 @@ def readconfig(options):
for opt in cfg.keys(): for opt in cfg.keys():
setattr(options,opt,cfg[opt]) setattr(options,opt,cfg[opt])
print("Read config from file") print("Read config from file")
return options return options
def writeconfig(options): def writeconfig(options):
@@ -626,7 +626,7 @@ def execute_plain():
shutil.copyfile(os.path.join(fullpath,'lib',jslib),os.path.join(libpath,jslib)) shutil.copyfile(os.path.join(fullpath,'lib',jslib),os.path.join(libpath,jslib))
inputs=[] inputs=[]
inputs.append((None,options.gallery,None)) inputs.append((None,options.gallery,None))
traverse(options.startpath,[options.startpath],inputs,options) traverse(options.startpath,[options.startpath],inputs,options)
return return

339
qalbum/Qnano2.py Executable file
View File

@@ -0,0 +1,339 @@
#!/usr/bin/env python
#
# Copyright 2018 Ville Rantanen
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys,os
import re
import urllib
import csv
import string
from datetime import datetime
from Qalbum import \
cleanthumbs, \
createthumbs, \
crumblinks, \
getdescriptions, \
getimagelist, \
getinfo, \
getnonconvertiblelist, \
getnonimagelist, \
getpathlist, \
nicestring, \
readconfig, \
sizestring, \
which, \
writeconfig
# (c) ville.q.rantanen@gmail.com
__version__='0.20180827'
imagesearch=re.compile('.*\.jpg$|.*\.jpeg$|.*\.gif$|.*\.png$|.*\.tif$|.*\.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('"')
singlequotes=re.compile("'")
stripquotes=re.compile('^"|"$')
FILECONFIG=".qalbum.config"
FILEINFO="info.txt"
FILEDESC="descriptions.csv"
def getheader(path,parent,title=""):
if title=="":
title=unicode(os.path.basename(path),encoding="utf8").encode('ascii', 'xmlcharrefreplace')
return '''<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="generator" content="Qalbum '''+__version__+'''">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://unpkg.com/nanogallery2@2.2.0/dist/css/nanogallery2.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="https://unpkg.com/nanogallery2@2.2.0/dist/jquery.nanogallery2.min.js"></script>
<TITLE>'''+title+'''</TITLE>
<script type="text/javascript">
$( document ).ready(function() {
$('.collapsible').each(function(i, obj) {
$(obj).children('h2').each(function () {
console.log(obj.id); // "this" is the current element in the loop
$(this).click(function(element) {
if ($(obj).height() == 28) {
$(obj).height('inherit');
$(obj).css('overflow','visible');
} else {
$(obj).height(28);
$(obj).css('overflow','hidden');
}
});
});
});
});
</script>
<style>
body {
margin: 5px;
}
#crumbcontainer {
font-size: small;
color: gray;
}
#crumbcontainer a {
color: gray;
}
.collapsible {
margin: 0px 10px 0px 0px;
padding: 0px 0px 0px 1em;
font-size: small;
border: 1px solid gray;
line-height: 2em;
}
.collapsible a {
color: black;
}
.collapsible h2 {
cursor: pointer;
margin-top: 0;
font-size: small;
color: gray;
}
.collapsible h2:hover {
text-decoration: underline;
}
#footer {
font-size: x-small;
color: gray;
}
#footer a {
color: gray;
}
</style>
</head>
<body>
'''
def getfooter():
return '''
<div id="footer">Generated with Qnano2 '''+__version__+''' ('''+datetime.today().strftime("%y-%m-%d %H:%M")+''') <a href="https://bitbucket.org/MoonQ/qalbum" target="_TOP">Source</a></div>
</BODY>
</HTML>
'''
def imagelinks(path,list):
''' Returns the HTML string of images '''
strout='''\n<div id="Qnano2-gallery" data-nanogallery2='{
"thumbnailHeight": 90,
"thumbnailWidth": 90,
"itemsBaseURL": "",
"thumbnailDisplayOutsideScreen": false,
"thumbnailLabel": {
"position": "onBottom",
"hideIcons": true,
"titleFontSize": "0.8em"
}
}'>
'''
descriptions=getdescriptions(path,list)
for n,i in enumerate(list):
nice=nicestring(i)
try:
desc=doublequotes.sub('',unicode(descriptions[n],encoding="utf8").encode('ascii', 'xmlcharrefreplace'))
except:
desc=doublequotes.sub('',filter(lambda x: x in string.printable, descriptions[n]).encode('ascii', 'xmlcharrefreplace'))
strout += '<a href=".med/%s.jpg" data-ngthumb=".tn/%s.jpg" data-ngdownloadurl="%s">%s</a><br>\n'%(
urllib.quote(i),
urllib.quote(i),
nice.encode('ascii', 'xmlcharrefreplace'),
desc
)
strout+='</div>'
return strout
def pathlinks(path, list):
''' Returns the HTML string of subfolders '''
if len(list)==0:
return '<div id="pathcontainer"></div>'
pathstr='<div id="pathcontainer" class="collapsible"><h2>Folders</h2>'
for p in list:
nice = nicestring(p)
imglist=getimagelist(os.path.join(path,p))
nsum=str(len(imglist))
imgstr=""
#~ if len(imglist)>0:
#~ imgstr='<span class="pathbox" style="background-image:url(\''+urllib.quote(p)+'/.tn/'+urllib.quote(imglist[0])+'.jpg\');">'
#~ else:
imgstr='<span class="pathbox">'
pathstr += '<div><li><a title="%s" href="%s/index.html">%s<span class="pathlink"><span class="pathlinktext">%s (%s)</span></span></span></a></div>'%(
unicode(p,encoding="utf8").encode('ascii', 'xmlcharrefreplace'),
urllib.quote(p),
imgstr,
nice.encode('ascii', 'xmlcharrefreplace'),
nsum
)
pathstr+='</div>'
return pathstr
def filelinks(path, list):
''' Returns the HTML string of non image files '''
if len(list) == 0:
return '<div id="attachmentcontainer"></div>'
strout = '<div id="attachmentcontainer" class="collapsible" style="height:28; overflow:hidden;">'
strout += '<h2>Attachments</h1>'
for i in list:
size=sizestring(os.path.getsize(os.path.join(path,i)))
strout+='<div class="attachmentbox"><li><a href="'+urllib.quote(i)+'">'+unicode(i,encoding="utf8").encode('ascii', 'xmlcharrefreplace')+' ['+size+']</a></div>'
strout+='</div>'
return strout
def traverse(path,crumbs,inputs,options):
''' The recursive main function to create the index.html and seek sub folders '''
print(path)
if (not options.recurselink) and (os.path.islink(path)):
print('Not recursing, is a link')
return
if len(crumbs)==1:
header = getheader(path,'../'*(len(crumbs)-1),inputs[0][1])
else:
header = getheader(path,'../'*(len(crumbs)-1))
pathlist = getpathlist(path, options)
imagelist = getimagelist(path, options)
if options.clean:
cleanthumbs(path)
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')
crumbstring=crumblinks(crumbs,options.gallery,options.parent)
pathstring=pathlinks(path, pathlist)
filestring=filelinks(path, filelist)
#filejs=filescript(path,filelist) # Filelist is not currently used in javascript
imagestring=imagelinks(path,imagelist)
#imagejs=imagescript(path,imagelist)
f=open(os.path.join(path,"index.html"),"w")
f.write(header)
f.write(crumbstring)
f.write(pathstring)
f.write('<div id="infocontainer">'+getinfo(path,options)+'</div>')
f.write(filestring)
f.write(imagestring)
f.write(getfooter())
f.close()
for p in pathlist:
nextcrumbs=[i for i in crumbs]
nextcrumbs.append(os.path.join(path,p))
traverse(os.path.join(path,p),nextcrumbs,inputs,options)
return
def setupoptions():
''' Setup the command line options '''
from argparse import ArgumentParser
parser=ArgumentParser()
parser.add_argument("-v",action='version', version=__version__)
parser.add_argument("--version",action='version', version=__version__)
parser.add_argument("-c",action="store_true",dest="writeconfig",default=False,
help="Write current configuration to file "+FILECONFIG+
" and exit. If file exists, settings read from the file, "+
"overriding switches.")
parser.add_argument("-r",action="store_true",dest="reverse",default=False,
help="Reverse sort orded")
parser.add_argument("-L",action="store_false",dest="recurselink",default=True,
help="List, but do not recurse in to symbolic link folders")
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,
help="Disable attachments")
parser.add_argument("-i",type=str,dest="infofile",default=FILEINFO,
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("--gravity",type=str,dest="gravity",default="Center",
help="ImageMagick gravity for cropping. (Default: %(default)s)")
parser.add_argument("-w", type = int, dest = "width",default = 1280,
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='?',
help="Root path of the gallery")
options=parser.parse_args()
options.startpath=os.path.abspath(options.startpath)
options=setupdefaultoptions(options)
return options
def setupdefaultoptions(options):
''' Adds the missing options for the options object '''
if not which('convert'):
print('You don\'t seem to have ImageMagick "convert" in PATH!')
sys.exit(1)
if 'attachments' not in options:
options.attachments=True
if 'clean' not in options:
options.clean=False
if 'force' not in options:
options.force=False
if 'infofile' not in options:
options.infofile=FILEINFO
if 'gallery' not in options:
options.gallery="Gallery"
if 'gravity' not in options:
options.gravity="Center"
if 'link' not in options:
options.link=False
if 'recursive' not in options:
options.recursive=True
if 'recurselink' not in options:
options.recurselink=True
if 'reverse' not in options:
options.reverse=False
if 'style' not in options:
options.style = None
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
def execute_plain():
''' Main execution function '''
options=setupoptions()
options=readconfig(options)
options=setupdefaultoptions(options)
if options.writeconfig:
writeconfig(options)
sys.exit(0)
# Copy all resources to target folder
pathname=os.path.dirname(__file__)
fullpath=os.path.abspath(pathname)
inputs=[]
inputs.append((None,options.gallery,None))
traverse(options.startpath,[options.startpath],inputs,options)
return
if __name__ == "__main__":
execute_plain()

11
scripts/Qnano2 Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from qalbum.Qnano2 import execute_plain
if __name__ == '__main__':
#sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(execute_plain())

View File

@@ -4,10 +4,11 @@ setup(
packages = ['qalbum'], packages = ['qalbum'],
scripts = ['scripts/Qalbum', scripts = ['scripts/Qalbum',
'scripts/Qalbum-thumbnailer', 'scripts/Qalbum-thumbnailer',
'scripts/Qnano2',
'scripts/Qalbum-descriptor'], 'scripts/Qalbum-descriptor'],
package_data={'':['lib/*']}, package_data={'':['lib/*']},
include_package_data=True, include_package_data=True,
version = '2.20180731', version = '2.20180827',
description = 'A tool to create a web gallery from a folder structure of images / other files.', description = 'A tool to create a web gallery from a folder structure of images / other files.',
author = 'Ville Rantanen', author = 'Ville Rantanen',
author_email = 'ville.q.rantanen@gmail.com', author_email = 'ville.q.rantanen@gmail.com',