Adding a new descriptor template
This commit is contained in:
@@ -39,15 +39,18 @@ def createdesc(path,list,options):
|
||||
nsum=len(list)
|
||||
for i in list:
|
||||
inpath=os.path.join(path,i)
|
||||
desc=create_description(inpath,options.format)
|
||||
outfile.write(i+"\t"+desc)
|
||||
desc=create_description(inpath,options.format).rstrip().replace('\n','<br/>')
|
||||
outfile.write(i+"\t"+desc+'\n')
|
||||
outfile.flush()
|
||||
print('('+str(n)+'/'+str(nsum)+') '+i+"\t"+desc[0:-1])
|
||||
print('('+str(n)+'/'+str(nsum)+') '+i+"\t"+desc)
|
||||
n+=1
|
||||
return
|
||||
|
||||
def create_description(infile,format):
|
||||
idargs=['identify','-format',format,infile+'[0]']
|
||||
if format=='AbsolutelyEverything':
|
||||
idargs=['identify','-verbose',infile+'[0]']
|
||||
else:
|
||||
idargs=['identify','-format',format,infile+'[0]']
|
||||
idp=subprocess.Popen(idargs,stdout=subprocess.PIPE)
|
||||
output = idp.stdout.read()
|
||||
return output
|
||||
@@ -87,7 +90,8 @@ def execute():
|
||||
presets=[
|
||||
'%f: %[EXIF:DateTimeOriginal]',
|
||||
'%f: %wx%h %[size]',
|
||||
'%f<br/><i>%[EXIF:DateTimeOriginal] %[EXIF:ExposureTime]s F%[EXIF:FNumber]</i>']
|
||||
'%f<br/><i>%[EXIF:DateTimeOriginal] %[EXIF:ExposureTime]s F%[EXIF:FNumber]</i>',
|
||||
'AbsolutelyEverything']
|
||||
if options.preset<1:
|
||||
print "Presets:"
|
||||
for row in range(len(presets)):
|
||||
@@ -95,7 +99,7 @@ def execute():
|
||||
sys.exit(0)
|
||||
if options.format=="":
|
||||
if options.preset>len(presets):
|
||||
parse.error("No such preset")
|
||||
parser.error("No such preset, list with -p 0")
|
||||
options.format=presets[options.preset-1]
|
||||
|
||||
traverse(options.startpath,options)
|
||||
|
||||
Reference in New Issue
Block a user