alexkarle.com

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

jam-index.sh (3224B) [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 html {
     21   max-width: 70ch;
     22   padding: 3em 1em;
     23   margin: auto;
     24   font-size: 1em;
     25   font-family: sans-serif;
     26 }
     27 footer {
     28   margin-top: 50px;
     29   font-size: .8em;
     30 }
     31 code { font-family: consolas, courier, monospace; }
     32 h1 { font-size: 1.5em; }
     33 h2 { font-size: 1.2em; }
     34 h3 { font-size: 1.1em; }
     35 blockquote, code pre {
     36   background: #f2f2f2;
     37   overflow: auto;
     38   padding: 10px;
     39   border: 2px solid black;
     40 }
     41 .jam-artists tr:nth-child(even) {
     42     background-color: #e3e3e3;
     43 }
     44 td.jam-artists, th.jam-artists, table.jam-artists {
     45     border: 1px solid black;
     46 }
     47 </style>
     48 <title>Jam Tuesday Archive</title>
     49 </head>
     50 <body>
     51 <small><code><a href="/">/home/alex</a> / <a href="/jam-tuesday">jam-tuesday</a></code></small>
     52 <h1>Jam Tuesday Archive</h1>
     53 <h2>About</h2>
     54 <p>
     55 From about October 2020 up until August 2021, my brother Matt and I
     56 got together every Tuesday evening to play music. It started as a
     57 way to stay sane during the COVID quarantine, but it quickly became
     58 a tradition and a highlight of the week.  No matter how stressful
     59 work was, or what was going on in the outside world, we could leave
     60 it all behind as we played some of our favorite tunes.
     61 </p>
     62 <p>
     63 At some point (woefully late), I realized it would be fun to start
     64 cataloging what we played.
     65 </p>
     66 <p>
     67 This archive includes the setlists and some play stats.
     68 </p>
     69 <p>
     70 There are no audio recordings (at least publicly), but there's a
     71 stray note here and there to "set the scene".
     72 </p>
     73 <p>
     74 The setlist notation is hopefully pretty straightforward. Unless
     75 otherwise noted, I'm on guitar and Matt's on keys (and if only one
     76 instrument is specified, it's me switching to it).  We both
     77 (attempt to) sing.  Sometimes we even harmonize :)
     78 </p>
     79 <h2>Stats</h2>
     80 EOM
     81 
     82 "$REPO"/bin/jam-stats.sh | sed \
     83     -e 's#^$#</ul>#' \
     84     -e 's#.*:$#<h3>&</h3>#' \
     85     -e 's#^-*$#<ul>#' \
     86     -e 's#^ *[0-9].*#<li>&</li>#'
     87 
     88 cat <<EOM
     89 </ul>
     90 <h2>Setlists</h2>
     91 Updated weekly:
     92 <ul>
     93 EOM
     94 
     95 for f in "$DIR"/[0-9][0-9][0-9][0-9]-*; do
     96     name=$(basename "$f")
     97     echo "<li><a href=\"/jam-tuesday/$name\">$name</a></li>"
     98 done
     99 
    100 cat <<EOM
    101 </ul>
    102 <h2>All Songs, by Artist</h2>
    103 <table class="jam-artists">
    104 <tr><th>Artist</th><th>Song</th><th>Plays</th></tr>
    105 EOM
    106 sed 's/.*, *//' "$ALL" | sort -u -f | while read artist; do
    107 	first=""
    108 	grep ", *$artist\$" "$ALL" | sort -f | sed "s#, *$artist *##" | uniq -c -i | \
    109 		while read plays song; do
    110 			if [ -z "$first" ]; then
    111 				first=1
    112 				echo "<tr><td>$artist</td><td>$song</td><td>$plays</td></tr>"
    113 			else
    114 				echo "<tr><td></td><td>$song</td><td>$plays</td></tr>"
    115 			fi
    116 		done
    117 done
    118 cat <<EOM
    119 </table>
    120 <br><br>
    121 <p style="font-size: 0.7em">Last Updated: $(date)</p>
    122 <p class="foot-license">
    123 © 2019-2022 Alex Karle | <a href="/">Home</a> | <a href="/license.html">License</a>
    124 </p>
    125 </body>
    126 </html>
    127 EOM