changeset 43:d92717f8130c

First go at producing a very simple website. Templating done with sed, and minimal HTML.
author Jim Hague <jim.hague@laicatc.com>
date Sun, 04 Mar 2012 12:39:12 +0000
parents 0e7d2830cb8b
children a636787724de
files .hgignore Session/intro.txt dottes.html.footer dottes.html.header makeWeb.sh makeWebItems.sh web/buzzard.jpg web/index.html
diffstat 8 files changed, 122 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Sun Mar 04 12:00:30 2012 +0000
+++ b/.hgignore	Sun Mar 04 12:39:12 2012 +0000
@@ -9,3 +9,4 @@
 syntax: regexp
 build/
 graphics/
+web/Session/
--- a/Session/intro.txt	Sun Mar 04 12:00:30 2012 +0000
+++ b/Session/intro.txt	Sun Mar 04 12:39:12 2012 +0000
@@ -1,2 +1,1 @@
-This book provides the dots for all tunes commonly played at Cry Havoc music
-sessions.
+This book provides the dots for all tunes commonly played at Cry Havoc music sessions.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dottes.html.footer	Sun Mar 04 12:39:12 2012 +0000
@@ -0,0 +1,3 @@
+</table>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dottes.html.header	Sun Mar 04 12:39:12 2012 +0000
@@ -0,0 +1,12 @@
+<html>
+<head>
+<title>Cry Havoc tunes - @BOOK@</title>
+</head>
+<body>
+<h1>@SUBTITLE@</h1>
+<p>
+@INTRO@
+<p>
+Issue @BUILD@
+<p>
+<table>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makeWeb.sh	Sun Mar 04 12:39:12 2012 +0000
@@ -0,0 +1,57 @@
+#!/bin/bash
+#
+# Build the website. The common items and the web items are assumed
+# to be already built.
+#
+
+if [ $# != 1 ]; then
+    echo "Usage: makeWeb.sh <book dir name>"
+    exit 1
+fi
+
+dir=`pwd`
+
+booke=$dir/$1
+webdir=$dir/web/$1
+graphicsdir=$dir/graphics/$1
+output=index.html
+
+buildno=`cat buildno.txt`
+subtitle=
+intro=
+if [ -r $booke/subtitle.txt ]; then
+    subtitle=`cat $booke/subtitle.txt`
+fi
+if [ -r $booke/intro.txt ]; then
+    intro=`cat $booke/intro.txt`
+fi
+
+mkdir -p $webdir
+
+sed -e "s/@BUILD@/$buildno/" -e "s/@SUBTITLE@/$subtitle/" \
+    -e "s/@INTRO@/$intro/" -e "s/@BOOK@/$1/" dottes.html.header > $webdir/$output
+
+# Now, for each tune, make the tune graphic and sound.
+find $booke -name "*.abc" | sort |
+    while read filename
+    do
+        title=`grep "^T:" $filename | head -1 | sed -e "s/^T: *//"`
+        name=`basename $filename .abc`
+
+        # Copy tune PDF from common graphics.
+        cp $graphicsdir/${name}.pdf $webdir
+
+        # And copy the ABC.
+        cp $filename $webdir
+
+        echo "<tr>" >> $webdir/$output
+        echo "<td>${title}</td>" >> $webdir/$output
+        echo "<td><a href=\"${name}.jpg\">JPG</a></td>" >> $webdir/$output
+        echo "<td><a href=\"${name}.pdf\">PDF</a></td>" >> $webdir/$output
+        echo "<td><a href=\"${name}.mid\">MIDI</a></td>" >> $webdir/$output
+        echo "<td><a href=\"${name}.mp3\">MP3</a></td>" >> $webdir/$output
+        echo "<td><a href=\"${name}.abc\">ABC</a></td>" >> $webdir/$output
+        echo "</tr>" >> $webdir/$output
+    done
+
+cat dottes.html.footer >> $webdir/$output
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/makeWebItems.sh	Sun Mar 04 12:39:12 2012 +0000
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# Make items required for the website but not for the book.
+# They go into web/<book>.
+#
+
+if [ $# != 1 ]; then
+    echo "Usage: makeWebItems.sh <book dir name>"
+    exit 1
+fi
+
+dir=`pwd`
+
+booke=$dir/$1
+builddir=$dir/web/$1
+graphicsdir=$dir/graphics/$1
+
+mkdir -p $builddir
+
+# Now, for each tune, make the tune JPG and sound.
+find $booke -name "*.abc" | sort |
+    while read filename
+    do
+        name=`basename $filename .abc`
+        convert $graphicsdir/${name}.eps $builddir/${name}.jpg
+
+        abc2midi $filename -o $builddir/${name}.mid
+        timidity -Ow -o $builddir/${name}.wav $builddir/${name}.mid
+        lame --quiet $builddir/${name}.wav $builddir/${name}.mp3
+        rm $builddir/${name}.wav
+    done
+
Binary file web/buzzard.jpg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/index.html	Sun Mar 04 12:39:12 2012 +0000
@@ -0,0 +1,16 @@
+<html>
+<head>
+<title>Ye Crie Havock Booke of Dottes</title>
+</head>
+<body>
+<h1>Ye Crie Havock Booke of Dottes</h1>
+<p>
+<center>
+<img src="buzzard.jpg" alt="Buzzard logo"/>
+</center>
+<p>
+The music of Cry Havoc, a reference.
+<p>
+<a href="Session/index.html">Sessions</a>
+</body>
+</html>