'''+title+'''
-
+
-
+
+
+
+
'''
@@ -184,7 +187,7 @@ def pathscript(path,list):
this_str='{ name:"'+unicode(p,encoding="utf8").encode('ascii', 'xmlcharrefreplace')+'", '
this_str+='size:'+str(len(imglist)+len(pathlist))+', '
if len(imglist)>0:
- this_str+='image:"'+unicode(p,encoding="utf8").encode('ascii', 'xmlcharrefreplace')+'/_tn/tn_'+unicode(imglist[0],encoding="utf8").encode('ascii', 'xmlcharrefreplace')+'.jpg"}'
+ this_str+='image:"'+unicode(p,encoding="utf8").encode('ascii', 'xmlcharrefreplace')+'/.tn/'+unicode(imglist[0],encoding="utf8").encode('ascii', 'xmlcharrefreplace')+'.jpg"}'
else:
this_str+='image:"" }'
elements.append(this_str)
@@ -203,7 +206,7 @@ def pathlinks(path,list):
nsum=str(len(imglist))
imgstr=""
if len(imglist)>0:
- imgstr=''
+ imgstr=''
else:
imgstr=''
pathstr+=''+imgstr+''+unicode(nice,encoding="utf8").encode('ascii', 'xmlcharrefreplace')+' ('+nsum+')';
@@ -248,7 +251,7 @@ def imagelinks(path,list):
except:
desc=doublequotes.sub('',filter(lambda x: x in string.printable, descriptions[n]).encode('ascii', 'xmlcharrefreplace'))
- strout+=' '+unicode(nice,encoding="utf8").encode('ascii', 'xmlcharrefreplace')+''
+ strout+=' '+unicode(nice,encoding="utf8").encode('ascii', 'xmlcharrefreplace')+''
n+=1
strout+=''
return strout
@@ -276,12 +279,12 @@ def filelinks(path,list):
return strout
def cleanthumbs(path):
- ''' clears _med and _tn for unused thumbs '''
+ ''' clears .med and .tn for unused thumbs '''
print('clearing unused thumbs...')
- if os.path.exists(os.path.join(path,'_tn')):
- clearfolder(path,os.path.join(path,'_tn'),re.compile("(^tn_)(.*)(.jpg)"))
- if os.path.exists(os.path.join(path,'_med')):
- clearfolder(path,os.path.join(path,'_med'),re.compile("(^med_)(.*)(.jpg)"))
+ if os.path.exists(os.path.join(path,'.tn')):
+ clearfolder(path,os.path.join(path,'.tn'),re.compile("(.*)(.jpg)"))
+ if os.path.exists(os.path.join(path,'.med')):
+ clearfolder(path,os.path.join(path,'.med'),re.compile("(.*)(.jpg)"))
return
def clearfolder(path,tnpath,regex):
@@ -290,7 +293,7 @@ def clearfolder(path,tnpath,regex):
for i in list:
f=regex.match(i)
try:
- if not os.path.exists(os.path.join(path,f.group(2))):
+ if not os.path.exists(os.path.join(path,f.group(1))):
print('removing '+i)
os.remove(os.path.join(tnpath,i))
except:
@@ -301,17 +304,17 @@ def createthumbs(path,list,options):
''' Runs imagemagick Convert to create medium sized and thumbnail images '''
if len(list)==0:
return
- if not os.path.exists(os.path.join(path,'_tn')):
- os.mkdir(os.path.join(path,'_tn'))
- if not os.path.exists(os.path.join(path,'_med')):
- os.mkdir(os.path.join(path,'_med'))
+ if not os.path.exists(os.path.join(path,'.tn')):
+ os.mkdir(os.path.join(path,'.tn'))
+ if not os.path.exists(os.path.join(path,'.med')):
+ os.mkdir(os.path.join(path,'.med'))
n=1
nsum=len(list)
r=str(options.width)
res=r+'x'+r+'>'
for i in list:
- outmedium=os.path.join(path,'_med','med_'+i+'.jpg')
- outthumb=os.path.join(path,'_tn','tn_'+i+'.jpg')
+ outmedium=os.path.join(path,'.med',i+'.jpg')
+ outthumb=os.path.join(path,'.tn',i+'.jpg')
inpath=os.path.join(path,i)
if (options.force) and os.path.exists(outmedium):
os.unlink(outmedium)
@@ -445,15 +448,9 @@ def traverse(path,crumbs,inputs,options):
header=getheader(path,'../'*(len(crumbs)-1),inputs[0][1])
else:
header=getheader(path,'../'*(len(crumbs)-1))
- if not os.path.exists(os.path.join(path,'../'*(len(crumbs)-1),'galleryscript.js')):
- print('Warning, no (relative path) galleryscript! '+os.path.join(path,'../'*(len(crumbs)-1),'galleryscript.js'))
- #depth=0
- #while not os.path.exists(os.path.join(path,'../'*(depth),'galleryscript.js')):
- # print(os.path.join(path,'../'*(depth)))
- # depth+=1
- #header=getheader(path,'../'*(depth))
-
- #print('Depth: '+str(len(crumbs)))
+ if not os.path.exists(os.path.join(path,'../'*(len(crumbs)-1),'.qalbum','gallery.js')):
+ print('Warning, no (relative path) galleryscript! '+os.path.join(path,'../'*(len(crumbs)-1),'.qalbum','gallery.js'))
+
pathlist=getpathlist(path,options)
imagelist=getimagelist(path,options)
if options.clean:
@@ -558,7 +555,7 @@ def setupdefaultoptions(options):
if 'reverse' not in options:
options.reverse=False
if 'style' not in options or options.style is None:
- options.style=os.path.join(os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0]))),'gallerystyle.css')
+ options.style=os.path.join(os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0]))),'lib','style.css')
if 'timesort' not in options:
options.timesort=False
if 'thumbs' not in options:
@@ -606,11 +603,14 @@ def execute_plain():
# Copy all resources to target folder
pathname=os.path.dirname(os.path.realpath(sys.argv[0]))
fullpath=os.path.abspath(pathname)
+ libpath=os.path.join(options.startpath,'.qalbum')
if not os.path.exists(options.style):
raise IOError('File not found: "'+options.style+'"')
- shutil.copyfile(options.style,os.path.join(options.startpath,'gallerystyle.css'))
- shutil.copyfile(os.path.join(fullpath,'galleryscript.js'),os.path.join(options.startpath,'galleryscript.js'))
-
+ if not os.path.isdir(libpath):
+ os.mkdir(libpath)
+ shutil.copyfile(options.style,os.path.join(libpath,'style.css'))
+ for jslib in ('gallery.js','jquery.js','jqzoom.js','touch.js'):
+ shutil.copyfile(os.path.join(fullpath,'lib',jslib),os.path.join(libpath,jslib))
inputs=[]
inputs.append((None,options.gallery,None))
diff --git a/galleryscript.js b/galleryscript.js
deleted file mode 100644
index 3c4698b..0000000
--- a/galleryscript.js
+++ /dev/null
@@ -1,1860 +0,0 @@
-/*
-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
- 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 .
-
- See other included library licenses further down the file.
-
-
- */
-
-
-/*!
- * jQuery JavaScript Library v1.4.2
- * http://jquery.com/
- *
- * Copyright 2010, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2010, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Sat Feb 13 22:33:48 2010 -0500
- */
-(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/,
-Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&&
-(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this,
-a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b===
-"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this,
-function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b