#!/bin/bash ######################################################## # createLONGmp3webpage.sh # usage ./createLONGmp3webpage.sh # NB SOULD BE RUN AFTER /setupmidimp3.sh script # creates a webpage to play all the archived tunes # set pathtoarchive before running # 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 mkdir -p $wpdir/img #directory to hold preview images rm $wpdir/img/* 2>/dev/null #empty but suppress errors if already empty #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 |sed -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 $( ls $wpdir/img ) #enumerate files in img directory do #for each file found name=$(echo $file |sed -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 |sed -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 #######################