fixing print command
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
@@ -48,7 +49,7 @@ def setup_options():
|
|||||||
"RD AspectRatioDiff.,Shp SharpnessIndex.")
|
"RD AspectRatioDiff.,Shp SharpnessIndex.")
|
||||||
parser.add_argument("--viewer",type=str,dest="viewer",default=None,
|
parser.add_argument("--viewer",type=str,dest="viewer",default=None,
|
||||||
help="Program to view images, %%f refers to filename(s)."+
|
help="Program to view images, %%f refers to filename(s)."+
|
||||||
"If '1', defaults to: 'geeqie -l %f'")
|
"If '1', defaults to: 'geeqie -l %%f'")
|
||||||
parser.add_argument("-x",action="append",dest="exclude",default=[],
|
parser.add_argument("-x",action="append",dest="exclude",default=[],
|
||||||
help="Exclude folder name from the lists. This option may be issued several times.")
|
help="Exclude folder name from the lists. This option may be issued several times.")
|
||||||
parser.add_argument('startpath', action="store",default='.', nargs='?')
|
parser.add_argument('startpath', action="store",default='.', nargs='?')
|
||||||
@@ -93,7 +94,7 @@ def delete_files(files):
|
|||||||
print("now delling")
|
print("now delling")
|
||||||
for hash in files:
|
for hash in files:
|
||||||
for f in hash[1]:
|
for f in hash[1]:
|
||||||
print f[0]
|
print(f[0])
|
||||||
os.remove(f[0])
|
os.remove(f[0])
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -152,11 +153,11 @@ def add_single(conn,filename,change=False,hash=None,minsize=0):
|
|||||||
if change:
|
if change:
|
||||||
db.execute("UPDATE list SET date=?, portrait=?, hash=?, width=? ,height=? \
|
db.execute("UPDATE list SET date=?, portrait=?, hash=?, width=? ,height=? \
|
||||||
WHERE file=?",(ftime,portrait,hash,dims[0],dims[1],filename))
|
WHERE file=?",(ftime,portrait,hash,dims[0],dims[1],filename))
|
||||||
print "changing: %(f)s (%(x)sx%(y)s)" % {'f':filename, 'x':dims[0], 'y':dims[1]}
|
print("changing: %(f)s (%(x)sx%(y)s)" % {'f':filename, 'x':dims[0], 'y':dims[1]})
|
||||||
else:
|
else:
|
||||||
db.execute("INSERT INTO list(file,date,portrait,hash,width,height)\
|
db.execute("INSERT INTO list(file,date,portrait,hash,width,height)\
|
||||||
VALUES(?,?,?,?,?,?)",(filename,ftime,portrait,hash,dims[0],dims[1]))
|
VALUES(?,?,?,?,?,?)",(filename,ftime,portrait,hash,dims[0],dims[1]))
|
||||||
print "adding: %(f)s (%(x)sx%(y)s)" % {'f':filename, 'x':dims[0], 'y':dims[1]}
|
print("adding: %(f)s (%(x)sx%(y)s)" % {'f':filename, 'x':dims[0], 'y':dims[1]})
|
||||||
return
|
return
|
||||||
|
|
||||||
def random_lists(sqlfile):
|
def random_lists(sqlfile):
|
||||||
@@ -242,8 +243,8 @@ def append_colors(sqlfile):
|
|||||||
if dirname!=dirname_old:
|
if dirname!=dirname_old:
|
||||||
dirname_old=dirname
|
dirname_old=dirname
|
||||||
filename=row[0]
|
filename=row[0]
|
||||||
print "colors: %(f)s (%(r)s %(g)s %(b)s)" % {'f':filename, 'r':colors[0][0],
|
print("colors: %(f)s (%(r)s %(g)s %(b)s)" % {'f':filename, 'r':colors[0][0],
|
||||||
'g':colors[0][1], 'b':colors[0][2]}
|
'g':colors[0][1], 'b':colors[0][2]})
|
||||||
i+=1
|
i+=1
|
||||||
if (i%50==0):
|
if (i%50==0):
|
||||||
conn.commit();
|
conn.commit();
|
||||||
@@ -370,7 +371,7 @@ def append_fingerprints(sqlfile):
|
|||||||
dirname_old=dirname
|
dirname_old=dirname
|
||||||
filename=row[0]
|
filename=row[0]
|
||||||
i+=1
|
i+=1
|
||||||
print "%(nr)i %(f)s" % {'f':filename, 'nr':i}
|
print("%(nr)i %(f)s" % {'f':filename, 'nr':i})
|
||||||
if (i%50==0):
|
if (i%50==0):
|
||||||
conn.commit();
|
conn.commit();
|
||||||
conn.commit()
|
conn.commit()
|
||||||
@@ -489,7 +490,7 @@ def find_fingerprint_nearest(opts):
|
|||||||
print("No measurements found")
|
print("No measurements found")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if this[1]==thr:
|
if this[1]==thr:
|
||||||
print("No similar images for "+cmp+", up to threshold "+str(thr))
|
print("No similar images for "+cmp+", up to threshold "+str(thr), file=sys.stderr)
|
||||||
return
|
return
|
||||||
file_len=str(max(len(cmp), len(this[0])))
|
file_len=str(max(len(cmp), len(this[0])))
|
||||||
print( ('{: <'+file_len+'} {: ^4} {: ^4} {: ^4} {: ^4} {: ^5}x{: ^5}').format("File","SD","CD","RD","Shp","W","H"))
|
print( ('{: <'+file_len+'} {: ^4} {: ^4} {: ^4} {: ^4} {: ^5}x{: ^5}').format("File","SD","CD","RD","Shp","W","H"))
|
||||||
@@ -520,7 +521,7 @@ def append_sharpness(sqlfile):
|
|||||||
dirname_old=dirname
|
dirname_old=dirname
|
||||||
filename=row[0]
|
filename=row[0]
|
||||||
i+=1
|
i+=1
|
||||||
print "%(nr)i %(f)s %(s)f" % {'f':filename, 'nr':i,'s':sp}
|
print("%(nr)i %(f)s %(s)f" % {'f':filename, 'nr':i,'s':sp})
|
||||||
if (i%50==0):
|
if (i%50==0):
|
||||||
conn.commit();
|
conn.commit();
|
||||||
conn.commit()
|
conn.commit()
|
||||||
@@ -585,7 +586,7 @@ def confirm(prompt=None, resp=False):
|
|||||||
if not ans:
|
if not ans:
|
||||||
return resp
|
return resp
|
||||||
if ans not in ['y', 'Y', 'n', 'N']:
|
if ans not in ['y', 'Y', 'n', 'N']:
|
||||||
print 'please enter y or n.'
|
print('please enter y or n.')
|
||||||
continue
|
continue
|
||||||
if ans == 'y' or ans == 'Y':
|
if ans == 'y' or ans == 'Y':
|
||||||
return True
|
return True
|
||||||
@@ -631,7 +632,7 @@ def print_structure(files):
|
|||||||
#print(hash[0])
|
#print(hash[0])
|
||||||
i=1
|
i=1
|
||||||
for f in hash[1]:
|
for f in hash[1]:
|
||||||
print "%(i)d: (%(x)dx%(y)d):%(f)s " % {'i':i, 'f':f[0], 'x':f[1], 'y':f[2]}
|
print("%(i)d: (%(x)dx%(y)d):%(f)s " % {'i':i, 'f':f[0], 'x':f[1], 'y':f[2]})
|
||||||
i+=1
|
i+=1
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -642,7 +643,7 @@ def print_dup_structure(files,opts):
|
|||||||
fnames=[]
|
fnames=[]
|
||||||
for f in hash[1]:
|
for f in hash[1]:
|
||||||
fnames.append(' "'+f[0]+'"')
|
fnames.append(' "'+f[0]+'"')
|
||||||
print "%(i)d:%(n)d:%(f)s " % {'i':i, 'n':len(fnames), 'f':",".join(fnames)}
|
print("%(i)d:%(n)d:%(f)s " % {'i':i, 'n':len(fnames), 'f':",".join(fnames)})
|
||||||
if opts.viewer:
|
if opts.viewer:
|
||||||
fnames=[x[0] for x in hash[1]]
|
fnames=[x[0] for x in hash[1]]
|
||||||
subprocess.call(opts.viewer.replace('%f', " ".join(fnames)), shell=True)
|
subprocess.call(opts.viewer.replace('%f', " ".join(fnames)), shell=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user