#!/bin/sh # Clean up from any previous runs. rm -f henryrec.sql all-completable-lists.js *.out for name in chamber opera orchestral song; do \ ./xml_to_sql.py \ --completable-kinds="composer,title,conductor,orchestra,soloists,accompanist,hall,nationality" \ < ${name}.xml >> henryrec.sql done # Escape all backslashes in the SQL. (This works because we happen to # know that all the backslashes are in strings. If we didn't know # that, we'd have to do this in xml_to_sql.py in a smarter way.) sed -e 's|\\|\\\\|g' < henryrec.sql > henryrec.sql.tmp mv henryrec.sql.tmp henryrec.sql # Build the completion (autofill) lists. for name in composer title conductor orchestra soloists accompanist hall nationality; do ./duplist-to-sortedlist < ${name}.out > ${name}.out.tmp mv ${name}.out.tmp ${name}.out gawk -- '{ print "\"" $0 "\"," }' ${name}.out > ${name}.out.tmp mv ${name}.out.tmp ${name}.out echo "var ${name}List = [" > ${name}-list.js cat ${name}.out >> ${name}-list.js truncate ${name}-list.js -s -2 echo "" >> ${name}-list.js echo "];" >> ${name}-list.js echo "" >> ${name}-list.js # Add it to the growing list-of-lists. cat ${name}-list.js >> all-completable-lists.js echo "" >> all-completable-lists.js done