# Take Henry's record database from ASCII export files to MySQL. default: all all: hide xml sql db # There's one file we don't publish, because it's idiosyncratic and # incomplete. We change its name right now, so that oprec.asc (which # we *do* publish) can become opera.xml without confusing us. hide: @if [ -f opera.asc ]; then mv -f opera.asc forbidden-opera.asc; fi xml: song.asc oprec.asc chamber.asc records.asc @echo "Converting ASCII exports to XML (watch for CHECK warnings)..." @./asc-to-xml.pl --song < song.asc > song.xml @./asc-to-xml.pl --chamber < chamber.asc > chamber.xml @./asc-to-xml.pl --opera < oprec.asc > opera.xml @./asc-to-xml.pl --orchestral < records.asc > orchestral.xml @echo "Done." sql: @rm -f henryrec.sql @echo "Converting XML files to SQL..." @ ./xml_to_sql.py < chamber.xml >> henryrec.sql @ ./xml_to_sql.py < opera.xml >> henryrec.sql @ ./xml_to_sql.py < orchestral.xml >> henryrec.sql @ ./xml_to_sql.py < song.xml >> henryrec.sql @echo "Done." db: @echo "Creating the database..." @echo "drop table henryrec;" | mysql -u henryrecrw --password=PASSWORD henryrec @cat create_henryrec.sql | mysql -u henryrecrw --password=PASSWORD henryrec @echo "Done." @echo "Loading the SQL..." @cat henryrec.sql | mysql -u henryrecrw --password=PASSWORD henryrec @echo "Done."