#!/bin/bash ######################################################## # createLONGmacwebpage.sh # usage run on a mac ./createLONGmacwebpage.sh after ./makemakearchive.sh # creates a webpage to play all the archived tunes # set pathtoarchive before running # requires coreutils, gsed, timidity, lame, imagemajick, lilypond to be installed # written by Robin Newman August 2013 ######################################################## pathtoarchive=~/long/archive2/ #end with trailing / wpdir=longwebpagefull #name of directory to hold finished webpage webpage=$wpdir/print.html #path to output webpage in archive directory p=`pwd` #save starting directory cd $pathtoarchive rm -r $wpdir 2>/dev/null mkdir -p $wpdir/img #directory to hold preview images mkdir $wpdir/mp3 #now setup web page header info cat all info to it until EOFhtml reached cat > $webpage << EOFhtml Random Rhythm 12-Tone Tunes

Random 12-Tone Tunes, With random Rhythms

EOFhtml for file in $( find ./ -name tonerow.png) #enumerate tonerow.png files do #for each file found #echo $file #uncomment for testing purposes n=$(echo $file |gsed -e 's/\.\/\///1' -e 's/\/.*//') #strip ./ at start & all after second / #echo $n #n holds date info for the file uncomment for testing purposes cp $file $wpdir/img/$n.png #copy and rename file into img directory done for file in $( find ./ -name tonerow.mp3) #enumerate tonerow.png files do #for each file found #echo $file #uncomment for testing purposes n=$(echo $file |gsed -e 's/\.\/\///1' -e 's/\/.*//') #strip ./ at start & all after second / #echo $n #n holds date info for the file uncomment for testing purposes cp $file $wpdir/mp3/$n.mp3 #copy and rename file into mp3 directory done for file in $( ls $wpdir/img ) #enumerate files in img directory do #for each file found name=$(echo $file |gsed -e 's/tone-//' -e 's/\..*//') #strip tone- and .img # now foramt name as yyyy-mm-dd at hh:mm and ss seconds name=$(echo $name |gsed -e 's/-/ at /3' -e 's/-/:/3' -e 's/-/ and /3' -e 's/$/ seconds/') mp3file=${file//\.png/\.mp3} #create mp3 filename replacing .img with .mp3 #now build rest of web page #insert title for tune,image and mp3 links for each tune echo processing tune for $name cat >> $webpage <Tune compose date $name

randomly generated 12-tone row

EOFhtml done echo 'mp3 version of webpage finished!' cd $p #switch back to starting directory echo 'Present working directory' pwd #################### End of script #######################