Code and data for arewedecentralizedyet.online and related projects
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Helper script to re-calculate nodeinfo

Intended for use when I change the nodeinfo parser enough that we should
re-generate old files

+52
+52
helpers/recalc-fedi-nodeinfo.sh
··· 1 + #!/bin/sh 2 + set -eu 3 + 4 + apply=0 5 + out_dir="data/fedi-mau" 6 + in_dir="data/nodeinfo" 7 + 8 + usage() { 9 + echo "Usage: $0 [--apply]" 1>&2 10 + exit 1 11 + } 12 + 13 + while [ $# -gt 0 ]; do 14 + case "$1" in 15 + --apply) 16 + apply=1 17 + shift 18 + ;; 19 + -h|--help) 20 + usage 21 + ;; 22 + *) 23 + usage 24 + ;; 25 + esac 26 + done 27 + 28 + files_found=0 29 + 30 + for path in "$out_dir"/*.csv; do 31 + [ -e "$path" ] || continue 32 + files_found=1 33 + base=$(basename "$path") 34 + ts=${base%.csv} 35 + backup="${path}.O" 36 + if [ -e "$backup" ]; then 37 + echo "Skipping $path (backup exists: $backup)" 38 + continue 39 + fi 40 + cmd="python3 data-processing/fedi-nodeinfo/parse-nodeinfo.py \"$in_dir\" \"$path\" --now \"$ts\"" 41 + if [ "$apply" -eq 1 ]; then 42 + mv "$path" "$backup" 43 + sh -c "$cmd" 44 + else 45 + echo "Would run: mv \"$path\" \"$backup\"" 46 + echo "Would run: $cmd" 47 + fi 48 + done 49 + 50 + if [ "$files_found" -eq 0 ]; then 51 + echo "No CSV files found in $out_dir" 52 + fi