added o for flipping originals. Added a tool for automating image description generation. Release 1.5

This commit is contained in:
ville rantanen
2012-01-27 13:27:33 +02:00
parent 5358e923e9
commit 218ca2a975
3 changed files with 144 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
# Copyright 2011 Ville Rantanen
# Copyright 2012 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
@@ -26,7 +26,7 @@ from datetime import datetime
# (c) ville.rantanen@helsinki.fi
__version__='1.5b'
__version__='1.5'
webfilesearch=re.compile('.*index.html$|.*gallerystyle.css$|.*galleryscript.js$|.*descriptions.csv$|\..*',re.I)
imagesearch=re.compile('.*\.jpg$|.*\.jpeg$|.*\.gif$|.*\.png$|.*\.svg$|.*\.pdf$',re.I)
@@ -50,6 +50,13 @@ def getheader(path,parent,title=""):
</HEAD>
<BODY>
'''
def getfooter():
return '''
<div id="footer">Generated with Qalbum '''+__version__+''' ('''+datetime.today().strftime("%y-%m-%d %H:%M")+''') <a href="http://code.google.com/p/qalbum/wiki/Usage" target="_TOP">Need help?</a></div>
<script language="javascript">setup();</script>
</BODY>
</HTML>
'''
def getimagelist(path):
''' Returns a list of images matching the regex '''
@@ -68,7 +75,7 @@ def getfiletimes(path,list):
''' Returns a list of modification times '''
times=[]
for p in list:
times.append(os.path.getmtime(os.path.join(path,p)))
times.append(int(os.path.getmtime(os.path.join(path,p))))
return times
def getnonimagelist(path):
@@ -237,9 +244,10 @@ def getdescriptions(path,list):
escapechar='\\',
quoting=csv.QUOTE_NONE)
for row in reader:
if row[0] in list:
i=list.index(stripquotes.sub('',row[0]))
desc[i]=stripquotes.sub('',row[1])
if len(row)>1:
if row[0] in list:
i=list.index(stripquotes.sub('',row[0]))
desc[i]=stripquotes.sub('',row[1])
return desc
def crumblinks(crumbs):
@@ -320,7 +328,7 @@ def traverse(path,crumbs):
f.write(imagestring)
f.write(filestring)
f.write('<div id="listcontainer"></div>')
f.write(footer)
f.write(getfooter())
f.close()
createthumbs(path,imagelist)
for p in pathlist:
@@ -339,12 +347,6 @@ class AndurilOptions:
self.attachments=True
def execute(cf):
global footer
footer='''
<div id="footer">Generated with Anduril ('''+datetime.today().strftime("%y-%m-%d %H:%M")+''')</div>
<script language="javascript">setup();</script>
</BODY>
</HTML>'''
global inputs
global options
inputs=[]
@@ -438,12 +440,6 @@ folder is the root folder of the image album.'''
# Copy all resources to target folder
shutil.copyfile(os.path.join(fullpath,'gallerystyle.css'),os.path.join(startpath,'gallerystyle.css'))
shutil.copyfile(os.path.join(fullpath,'galleryscript.js'),os.path.join(startpath,'galleryscript.js'))
global footer
footer='''
<div id="footer">Generated with Qalbum '''+__version__+''' ('''+datetime.today().strftime("%y-%m-%d %H:%M")+''') <a href="http://code.google.com/p/qalbum/wiki/Usage" target="_TOP">Need help?</a></div>
<script language="javascript">setup();</script>
</BODY>
</HTML>'''
global inputs
inputs=[]
inputs.append((None,'Gallery',None))