#! /usr/bin/env python # ----------------------------------------------------------------------------- # # Name : genhtml_onestop.py # # Purpose : # # Usage : # # Options : # # Arguements : # # Created : 26-OCT-2005 hobbs # Modified : 17-APR-2007 rickv # # ----------------------------------------------------------------------------- import glob import os def genhtml_onestop(): # Get the file information files = glob.glob("thumbnails/*.jpeg") files.sort() base = [] types = [] for name in files: basename = os.path.basename(name) base.append(os.path.splitext(basename)[0]) types.append(0) if os.path.exists(base[-1]+".eps"): types[-1] |= 1 if os.path.exists(base[-1]+".ps"): types[-1] |= 2 if os.path.exists(base[-1]+".gif"): types[-1] |= 4 if os.path.exists(base[-1]+".jpeg"): types[-1] |= 8 if os.path.exists(base[-1]+".png"): types[-1] |= 16 if os.path.exists(base[-1]+"_col.eps"): types[-1] |=32 if os.path.exists(base[-1]+"_col.jpeg"): types[-1] |=64 if os.path.exists(base[-1]+".caption"): types[-1] |= 128 print name," --> ",basename," --> ",base[-1]," has ",types[-1] # Get the pdf conference note name assuming the standard structure. cwd = os.getcwd() fbase = os.path.basename(cwd) note = fbase+".pdf" # Get the information from driver text file driver = fbase+".txt" f=open(driver,'r') print f title=f.readline() print title lumi=f.readline() print lumi fnalp=f.readline() print fnalp prepr=f.readline() print prepr jstat=f.readline() print jstat pub=jstat.count('Published') if pub > 0: vol=f.readline() pag=f.readline() year=f.readline() print "Volume ",vol," page ",pag, " year ",year # See if there's a plain english summary in the standard convention pes = "" if os.path.exists(fbase+".html"): pes = fbase+".html" elif os.path.exists(fbase+".htm"): pes = fbase+".htm" # Write some simple HTML, including the pdf for the note html = open("index.html","w") html.write("\n
\n\n") html.write("Figures | |||
|---|---|---|---|
"%base[i]) if types[i] & 1: html.write("(eps) "%base[i]) if types[i] & 32: html.write("(color eps) "%base[i]) if types[i] & 2: html.write("(ps) "%base[i]) if types[i] & 4: html.write("(gif) "%base[i]) if types[i] & 8: html.write("(jpeg) "%base[i]) if types[i] & 64: html.write("(color jpeg) "%base[i]) if types[i] & 16: html.write("(png) "%base[i]) if types[i] & 128: html.write("(caption) "%base[i]) html.write(" | \n")
if (i+1)%4 == 0: html.write(" |||