commit b07407566c03602aed71575c07e51bb42df4aed5 (patch)
parent 4cfdd7998ce6c2199ff03edad326b50ee18b495d
Author: Alex Karle <alex@alexkarle.com>
Date: Tue, 20 Jul 2021 23:34:07 -0400
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 :)
Diffstat:
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git 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
@@ -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)"