removed reference to Anduril
This commit is contained in:
90
Qalbum.py
90
Qalbum.py
@@ -415,88 +415,10 @@ def setupdefaultoptions(options):
|
|||||||
options.width=850
|
options.width=850
|
||||||
return options
|
return options
|
||||||
|
|
||||||
class AndurilOptions:
|
|
||||||
'''Object featuring same variables as arguments from command line.'''
|
|
||||||
|
|
||||||
def __init__(self, timesort, reverse):
|
|
||||||
'''Initializes the person's data.'''
|
|
||||||
self.timesort=timesort
|
|
||||||
self.reverse=reverse
|
|
||||||
self.attachments=True
|
|
||||||
|
|
||||||
def execute(cf):
|
|
||||||
inputs=[]
|
|
||||||
inputs.append((cf.get_input('folderRoot'),'',cf.get_input('csvRoot')))
|
|
||||||
for i in range(8):
|
|
||||||
inputs.append((cf.get_input('folder'+str(i+1)),cf.get_parameter('title'+str(i+1)),cf.get_input('csv'+str(i+1))))
|
|
||||||
fileCol=cf.get_parameter('fileCol')
|
|
||||||
annotationCol=cf.get_parameter('annotationCol')
|
|
||||||
options=AndurilOptions(cf.get_parameter('sortTime','boolean'),
|
|
||||||
cf.get_parameter('sortReverse','boolean'))
|
|
||||||
options=setupdefaultoptions(options)
|
|
||||||
outDir = cf.get_output('gallery')
|
|
||||||
# the folderRoot demands that the outDir is not created earlier.
|
|
||||||
if inputs[0][0]==None:
|
|
||||||
os.mkdir(outDir)
|
|
||||||
else:
|
|
||||||
shutil.copytree(inputs[0][0],os.path.join(outDir,inputs[0][1]))
|
|
||||||
|
|
||||||
for d in inputs:
|
|
||||||
if (d[0]==None):
|
|
||||||
continue
|
|
||||||
if not os.path.exists(d[0]):
|
|
||||||
continue
|
|
||||||
print('Copying gallery '+d[1])
|
|
||||||
cf.write_log('Copying gallery '+d[1])
|
|
||||||
if not os.path.exists(os.path.join(outDir,d[1])):
|
|
||||||
shutil.copytree(d[0],os.path.join(outDir,d[1]))
|
|
||||||
# Find the annotations
|
|
||||||
if (d[2] is not None):
|
|
||||||
reader = csv.DictReader(open(d[2],'rb'),
|
|
||||||
delimiter='\t',
|
|
||||||
doublequote=False,
|
|
||||||
escapechar='\\',
|
|
||||||
quoting=csv.QUOTE_ALL)
|
|
||||||
for row in reader:
|
|
||||||
break
|
|
||||||
if (fileCol not in reader.fieldnames):
|
|
||||||
cf.write_error("Column \""+fileCol+"\" not found.")
|
|
||||||
exit()
|
|
||||||
if (annotationCol not in reader.fieldnames):
|
|
||||||
cf.write_error("Column \""+annotationCol+"\" not found.")
|
|
||||||
exit()
|
|
||||||
reader = csv.DictReader(open(d[2],'rb'),
|
|
||||||
delimiter='\t',
|
|
||||||
doublequote=False,
|
|
||||||
escapechar=None,
|
|
||||||
quotechar='"',
|
|
||||||
quoting=csv.QUOTE_NONE)
|
|
||||||
annotations=[]
|
|
||||||
header=['file','description']
|
|
||||||
for row in reader:
|
|
||||||
annotations.append( (stripquotes.sub('',row.get('"'+fileCol+'"')), stripquotes.sub('',row.get('"'+annotationCol+'"')) ) )
|
|
||||||
writefid=open(os.path.join(outDir,d[1],'descriptions.csv'),'wb')
|
|
||||||
writer = csv.writer(writefid,
|
|
||||||
delimiter='\t',
|
|
||||||
doublequote=False,escapechar='\\',
|
|
||||||
quotechar='"',
|
|
||||||
quoting=csv.QUOTE_NONE)
|
|
||||||
writer.writerow(header)
|
|
||||||
for r in annotations:
|
|
||||||
writer.writerow([r[0],r[1]])
|
|
||||||
writefid.close()
|
|
||||||
# Copy all resources to target folder
|
|
||||||
shutil.copyfile('gallerystyle.css',os.path.join(outDir,'gallerystyle.css'))
|
|
||||||
shutil.copyfile('galleryscript.js',os.path.join(outDir,'galleryscript.js'))
|
|
||||||
inputs[0]=((cf.get_input('folderRoot'),cf.get_parameter('titleRoot'),cf.get_input('csvRoot')))
|
|
||||||
options.startpath=os.path.abspath(outDir)
|
|
||||||
traverse(options.startpath,[options.startpath],inputs,options)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
def execute_plain():
|
def execute_plain():
|
||||||
''' Execute this if run outside anduril '''
|
''' Main execution function '''
|
||||||
options=setupoptions()
|
options=setupoptions()
|
||||||
|
options=setupdefaultoptions(options)
|
||||||
# Copy all resources to target folder
|
# Copy all resources to target folder
|
||||||
pathname=os.path.dirname(os.path.realpath(sys.argv[0]))
|
pathname=os.path.dirname(os.path.realpath(sys.argv[0]))
|
||||||
fullpath=os.path.abspath(pathname)
|
fullpath=os.path.abspath(pathname)
|
||||||
@@ -511,10 +433,4 @@ def execute_plain():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
execute_plain()
|
||||||
import component_skeleton.main
|
|
||||||
except ImportError:
|
|
||||||
execute_plain()
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
component_skeleton.main.main(execute)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user