From b07407566c03602aed71575c07e51bb42df4aed5 Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Tue, 20 Jul 2021 23:34:07 -0400 Subject: [PATCH] jam-tuesday: Add number of sessions to archive page I've just been wondering this myself recently. Makes computing the number of Front Bottoms played per session easier :) --- Makefile | 2 +- bin/jam-stats.sh | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d655df1..94fdfad 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ index.html: atom.xml: blog.7 bin/genatom.sh ./bin/genatom.sh > $@ -jam-tuesday/index.html: $(SETS) bin/jam-index.sh +jam-tuesday/index.html: $(SETS) bin/jam-index.sh bin/jam-stats.sh ./bin/jam-index.sh > $@ jam-tuesday/greatest-hits: $(SETS) bin/jam-stats.sh diff --git a/bin/jam-stats.sh b/bin/jam-stats.sh index 3ebb657..e2ffa86 100755 --- a/bin/jam-stats.sh +++ b/bin/jam-stats.sh @@ -6,10 +6,12 @@ N=${1:-10} REPO=$(dirname "$(dirname "$0")") DIR="$REPO/jam-tuesday" TMP=$(mktemp) +num_sessions=0 for set in "$DIR"/[0-9][0-9][0-9][0-9]-*; do # Remove leading notes, blank lines, and instrument/reprise # comments (and blank lines before or after the comments) sed '1,/---/d' "$set" | grep -v '^ *$' | sed 's/ *([^)]*) *//g' + num_sessions=$((num_sessions + 1)) done > "$TMP" artists() { @@ -26,6 +28,7 @@ topN() { echo "Play Stats:" echo "-----------" +printf "%4d Jam Sessions\\n" "$num_sessions" printf "%4d Songs Total\\n" "$(wc -l < "$TMP")" printf "%4d Unique Songs\\n" "$(songs | wc -l)" printf "%4d Unique Artists\\n\\n" "$(artists | wc -l)" -- libgit2 1.8.1