alexkarle.com

Source for alexkarle.com
git clone git://git.alexkarle.com/alexkarle.com.git
Log | Files | Refs | README | LICENSE

jam-index.sh (2647B) [raw]


      1 #!/bin/sh
      2 set -e
      3 REPO=$(dirname "$(dirname "$0")")
      4 DIR="$REPO/www/jam-tuesday"
      5 
      6 # Prep for the by artist listing
      7 ALL=$(mktemp)
      8 for f in "$DIR"/[0-9][0-9][0-9][0-9]-*; do
      9 	sed '1,/---/d' $f | grep -v '^ *$' | sed 's/ *([^)]*) *//g'
     10 done | sort -f > "$ALL"
     11 
     12 cat <<EOM
     13 <!DOCTYPE html>
     14 <html lang="en">
     15 <head>
     16 <meta charset="utf-8"/>
     17 <meta name="viewport" content="width=device-width,initial-scale=1">
     18 <!-- Inspired by https://www.swyx.io/css-100-bytes/ -->
     19 <style>
     20 EOM
     21 cat "$REPO/www/style.css"
     22 cat <<EOM
     23 .jam-artists tr:nth-child(even) {
     24     background-color: #f2f2bd;
     25 }
     26 table.jam-artists {
     27     margin: 0 auto;
     28     border: 1px solid black;
     29 }
     30 </style>
     31 <title>Jam Tuesday Archive</title>
     32 </head>
     33 <body>
     34 <nav>
     35 /
     36 <a href="/">home</a>
     37 </nav>
     38 <h1>Jam Tuesday Archive</h1>
     39 <h2>About</h2>
     40 <p>
     41 From about October 2020 up until August 2021, my brother Matt and I
     42 got together every Tuesday evening to play music. It started as a
     43 way to stay sane during the COVID quarantine, but it quickly became
     44 a tradition and a highlight of the week.  No matter how stressful
     45 work was, or what was going on in the outside world, we could leave
     46 it all behind as we played some of our favorite tunes.
     47 </p>
     48 <p>
     49 At some point (woefully late), I realized it would be fun to start
     50 cataloging what we played.
     51 </p>
     52 <p>
     53 This archive includes the setlists and some play stats.
     54 </p>
     55 <p>
     56 There are no audio recordings (at least publicly), but there's a
     57 stray note here and there to "set the scene".
     58 </p>
     59 <p>
     60 The setlist notation is hopefully pretty straightforward. Unless
     61 otherwise noted, I'm on guitar and Matt's on keys (and if only one
     62 instrument is specified, it's me switching to it).  We both
     63 (attempt to) sing.  Sometimes we even harmonize :)
     64 </p>
     65 <h2>Stats</h2>
     66 EOM
     67 
     68 "$REPO"/bin/jam-stats.sh | sed \
     69     -e 's#^$#</ul>#' \
     70     -e 's#.*:$#<h3>&</h3>#' \
     71     -e 's#^-*$#<ul>#' \
     72     -e 's#^ *[0-9].*#<li>&</li>#'
     73 
     74 cat <<EOM
     75 </ul>
     76 <h2>Setlists</h2>
     77 Updated weekly:
     78 <ul>
     79 EOM
     80 
     81 for f in "$DIR"/[0-9][0-9][0-9][0-9]-*; do
     82     name=$(basename "$f")
     83     echo "<li><a href=\"/jam-tuesday/$name\">$name</a></li>"
     84 done
     85 
     86 cat <<EOM
     87 </ul>
     88 <h2>All Songs, by Artist</h2>
     89 <table class="jam-artists">
     90 <tr><th>Artist</th><th>Song</th><th>Plays</th></tr>
     91 EOM
     92 sed 's/.*, *//' "$ALL" | sort -u -f | while read artist; do
     93 	first=""
     94 	grep ", *$artist\$" "$ALL" | sort -f | sed "s#, *$artist *##" | uniq -c -i | \
     95 		while read plays song; do
     96 			if [ -z "$first" ]; then
     97 				first=1
     98 				echo "<tr><td>$artist</td><td>$song</td><td>$plays</td></tr>"
     99 			else
    100 				echo "<tr><td></td><td>$song</td><td>$plays</td></tr>"
    101 			fi
    102 		done
    103 done
    104 cat <<EOM
    105 </table>
    106 <p>Last Updated: $(date)</p>
    107 </body>
    108 </html>
    109 EOM