plot2b2t/fetchparse.sh

16 lines
489 B
Bash
Executable File

#!/bin/zsh
QUEUE="$(curl -sSL https://2b2t.io/api/queue\?range=$1)"
PRIO="$(curl -sSL https://2b2t.io/api/prioqueue\?range=$1)"
PLAY="$(curl -sSL https://2b2t.io/api/pingstats\?range=$1)"
function gnuplot-parsable {
TIMES=($(print $1 | jq '.[][0]'))
VALUES=($(print $1 | jq '.[][1]'))
for ((i=0; i<${#TIMES[@]};i++)); do
printf "%s\t%s\n" $TIMES[$i] $VALUES[$i];
done
}
gnuplot-parsable "$QUEUE" > queuedata
gnuplot-parsable "$PRIO" > priodata
gnuplot-parsable "$PLAY" > playerdata