alexkarle.com

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

jam-index.sh (2726B) [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 | alexkarle.com</title>
     32 </head>
     33 <body>
     34 <nav>
     35 <a href="/">Home</a> |
     36 <a href="/blog">Blog</a> |
     37 <a href="/license.html">License</a>
     38 </nav>
     39 <h1>Jam Tuesday Archive</h1>
     40 <h2>About</h2>
     41 <p>
     42 From about October 2020 up until August 2021, my brother Matt and I
     43 got together every Tuesday evening to play music. It started as a
     44 way to stay sane during the COVID quarantine, but it quickly became
     45 a tradition and a highlight of the week.  No matter how stressful
     46 work was, or what was going on in the outside world, we could leave
     47 it all behind as we played some of our favorite tunes.
     48 </p>
     49 <p>
     50 At some point (woefully late), I realized it would be fun to start
     51 cataloging what we played.
     52 </p>
     53 <p>
     54 This archive includes the setlists and some play stats.
     55 </p>
     56 <p>
     57 There are no audio recordings (at least publicly), but there's a
     58 stray note here and there to "set the scene".
     59 </p>
     60 <p>
     61 The setlist notation is hopefully pretty straightforward. Unless
     62 otherwise noted, I'm on guitar and Matt's on keys (and if only one
     63 instrument is specified, it's me switching to it).  We both
     64 (attempt to) sing.  Sometimes we even harmonize :)
     65 </p>
     66 <h2>Stats</h2>
     67 EOM
     68 
     69 "$REPO"/bin/jam-stats.sh | sed \
     70     -e 's#^$#</ul>#' \
     71     -e 's#.*:$#<h3>&</h3>#' \
     72     -e 's#^-*$#<ul>#' \
     73     -e 's#^ *[0-9].*#<li>&</li>#'
     74 
     75 cat <<EOM
     76 </ul>
     77 <h2>Setlists</h2>
     78 Updated weekly:
     79 <ul>
     80 EOM
     81 
     82 for f in "$DIR"/[0-9][0-9][0-9][0-9]-*; do
     83     name=$(basename "$f")
     84     echo "<li><a href=\"/jam-tuesday/$name\">$name</a></li>"
     85 done
     86 
     87 cat <<EOM
     88 </ul>
     89 <h2>All Songs, by Artist</h2>
     90 <table class="jam-artists">
     91 <tr><th>Artist</th><th>Song</th><th>Plays</th></tr>
     92 EOM
     93 sed 's/.*, *//' "$ALL" | sort -u -f | while read artist; do
     94 	first=""
     95 	grep ", *$artist\$" "$ALL" | sort -f | sed "s#, *$artist *##" | uniq -c -i | \
     96 		while read plays song; do
     97 			if [ -z "$first" ]; then
     98 				first=1
     99 				echo "<tr><td>$artist</td><td>$song</td><td>$plays</td></tr>"
    100 			else
    101 				echo "<tr><td></td><td>$song</td><td>$plays</td></tr>"
    102 			fi
    103 		done
    104 done
    105 cat <<EOM
    106 </table>
    107 <p>Last Updated: $(date)</p>
    108 </body>
    109 </html>
    110 EOM