Symbolic link recursion option, added m key for displaying all medium sized images

This commit is contained in:
ville rantanen
2012-10-25 09:43:33 +03:00
parent 3ca395dfbf
commit 7c9ab33043
3 changed files with 44 additions and 1 deletions

View File

@@ -352,11 +352,23 @@ def sizestring(size):
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)):
print('Not recursing, is a link')
return
if len(crumbs)==1: if len(crumbs)==1:
header=getheader(path,'../'*(len(crumbs)-1),inputs[0][1]) header=getheader(path,'../'*(len(crumbs)-1),inputs[0][1])
else: else:
header=getheader(path,'../'*(len(crumbs)-1)) 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))) print('Depth: '+str(len(crumbs)))
pathlist=getpathlist(path,options) pathlist=getpathlist(path,options)
imagelist=getimagelist(path,options) imagelist=getimagelist(path,options)
@@ -412,6 +424,8 @@ def setupoptions():
parser.add_argument("--version",action='version', version=__version__) parser.add_argument("--version",action='version', version=__version__)
parser.add_argument("-r",action="store_true",dest="reverse",default=False, parser.add_argument("-r",action="store_true",dest="reverse",default=False,
help="Reverse sort orded") 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", parser.add_argument("-s",type=str,dest="style",
help="User defined CSS style file.") help="User defined CSS style file.")
parser.add_argument("-t",action="store_true",dest="timesort",default=False, parser.add_argument("-t",action="store_true",dest="timesort",default=False,
@@ -445,6 +459,8 @@ def setupdefaultoptions(options):
options.link=False options.link=False
if 'recursive' not in options: if 'recursive' not in options:
options.recursive=True options.recursive=True
if 'recurselink' not in options:
options.recurselink=True
if 'reverse' not in options: if 'reverse' not in options:
options.reverse=False options.reverse=False
if 'style' not in options or options.style is None: if 'style' not in options or options.style is None:

View File

@@ -1152,7 +1152,7 @@ function getThumbStartEnd(n,maxThumb) {
function allthumbs() { function allthumbs() {
// Shows all the thumbnails in the current folder // Shows all the thumbnails in the current folder
thumbstr='<h2>Images</h2><div id="thumbrow">'; thumbstr='<div id="thumbrow">';
for (i=0; i<imagelist.length; i++) { for (i=0; i<imagelist.length; i++) {
thumbstr+='<span id="n'+i+'" class="imagebox thumbbox"><img title="'+titlestring(imagedesc[i])+'" onclick="showimage('+String(i)+')" src="_tn/tn_'+(encodeURIComponent(imagelist[i]))+'.jpg"></span>'; thumbstr+='<span id="n'+i+'" class="imagebox thumbbox"><img title="'+titlestring(imagedesc[i])+'" onclick="showimage('+String(i)+')" src="_tn/tn_'+(encodeURIComponent(imagelist[i]))+'.jpg"></span>';
} }
@@ -1165,6 +1165,21 @@ function allthumbs() {
return; return;
} }
function allmediums() {
// Shows all the medium sized in the current folder
thumbstr='<div id="thumbrow">';
for (i=0; i<imagelist.length; i++) {
thumbstr+='<span id="n'+i+'" class="medium"><img title="'+titlestring(imagedesc[i])+'" onclick="showimage('+String(i)+')" src="_med/med_'+(encodeURIComponent(imagelist[i]))+'.jpg"></span>';
}
thumbstr+='</div>';
$('#thumbcontainer').html(thumbstr);
$('#imagecontainer').html('');
$('#imagecontainer').css('height',0);
$('#desccontainer').hide();
currentimage=-1;
return;
}
function subfoldersmalllist() { function subfoldersmalllist() {
// Shows a small subfolder list // Shows a small subfolder list
pathstr='<span class="pathsmalllink">Subfolders: '; pathstr='<span class="pathsmalllink">Subfolders: ';
@@ -1561,6 +1576,10 @@ function keypressed(e) {
if (unicode==70) { if (unicode==70) {
flipfullscreen(); flipfullscreen();
} }
// m: mediums
if (unicode==77) {
allmediums();
}
// o: originals // o: originals
if (unicode==79) { if (unicode==79) {
fliporiginals(); fliporiginals();

View File

@@ -20,6 +20,14 @@ body {
background-color: white; background-color: white;
cursor: pointer; cursor: pointer;
} }
.medium {
float: left;
margin-top: 0px;
padding-top: 2px;
padding-left: 8px;
padding-right: 8px;
cursor: pointer;
}
.pathlink { .pathlink {
word-wrap: break-word; word-wrap: break-word;
display: table-cell; display: table-cell;