#!/bin/sh # Usage: updateheader [scriptfile [ppthtmltocfile [combinedfilebase]] ] # Generate a new header that has markers for each of the slide flips # # scriptfile is a file generated by the Windows Media 9 Windows Media # File Editor and if scriptfile is not present, then the default is a # file with the same name as the current directory, so if this script # is run in berkeley/01, then we look for berkeley/01/01.txt # # If scriptfile is present, then the second argument is assumed to be # an html file containing the table of contents that titles of the # the powerpoint files. The script ppttitles is used to read # the ppthtmltocfile and generate a list of slide titles # The default is a directory with the same name as the current directory, # so if this file is run in berkeley/01, then we look for # berkeley/01/01/index.htm # # If the ppthtmltocfile argument is present, then the third argument # is should be the talk name of the combined ppt file, for example 11. # The idea here is that the asf file has slide events that point # to the directory that contains the combined ppt file. combinedfilebase="" if [ $1 = "-d" ]; then # Turn on debugging shift set -x fi if [ $# -eq 3 ]; then scriptfile=$1 ppthtmltocfile=$2 combinedfilebase=$3 else if [ $# -eq 2 ]; then scriptfile=$1 ppthtmltocfile=$2 else if [ $# -eq 1 ]; then scriptfile=$1 base=`basename $scriptfile | awk -F. '{print $1}'` ppthtmltocfile=`dirname $scriptfile`/$base/index.htm else basedir=`basename $PWD` scriptfile=$basedir.txt ppthtmltocfile=$basedir/index.htm fi fi fi if [ ! -r $scriptfile ]; then echo "$0: Cannot read script file '$scriptfile'" echo " $scriptfile should be generated by running the Windows" echo " Media File Editor on an asf file and exporting the header, see" echo " `dirname $scriptfile`/README.htm" exit 5 fi if [ ! -r $ppthtmltocfile ]; then echo "$0: Cannot read '$ppthtmltocfile'" echo " $ppthtmltocfile should be generated by PowerPoint save as" echo " html. This file is used to map file names to titles." exit 5 fi if [ -f /usr/local/bin/saxon ]; then SAXON=/usr/local/bin/saxon else SAXON=saxon fi xsltdirectory=`dirname $0 | sed 's@/cygdrive/\([a-z]\)@\1:@'` if [ ! -d $xsldirectory ]; then echo "$0: Cannot find '$xsltdirectory' directory" exit 8 fi # scriptfilebase should be the talk name, for example 01 scriptfilebase=`basename $scriptfile | awk -F. '{print $1}'` if [ "$combinedfilebase" = "" ]; then scriptfilepath=$scriptfilebase combinedfilebase=$scriptfilebase else # The user specified a combinedfilebase argument, assume that the # we have a combined ppt file scriptfilepath="../$combinedfilebase" if [ ! -d $scriptfilepath ]; then echo "$0: warning $scriptfilepath does not exist, yet $combinedfilebase" echo " was specified" fi fi tmpfile=`dirname $scriptfile`/$scriptfilebase echo "Converting from UTF-16 to UTF-8" $SAXON $scriptfile $xsltdirectory/copy.xsl > ${tmpfile}_1.xml # getCommandPath targetCommandCount filename # Look through filename find the targetCommandCount-th Command=, # find the corresponding url and remove the last directory and filename # and return that value. # # For example, the file might contain #