Skip to content

Instantly share code, notes, and snippets.

@bwbroersma
Created June 5, 2021 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bwbroersma/f5810c0237346ef2694b96c04d1f5968 to your computer and use it in GitHub Desktop.
Save bwbroersma/f5810c0237346ef2694b96c04d1f5968 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ "$#" -ne 2 ]; then
>&2 echo "Usage: $0 YEAR audio.mp3"
exit 1
fi
if [ ! -f "$2" ]; then
>&2 echo "$2 does not exist."
exit 1
fi
command -v curl >/dev/null 2>&1 || { echo >&2 "Please install 'curl' first: $ sudo apt install curl."; exit 1; }
command -v jq >/dev/null 2>&1 || { echo >&2 "Please install 'jq' first: $ sudo apt install jq."; exit 1; }
command -v ffplay >/dev/null 2>&1 || { echo >&2 "Please install 'ffmpeg' first: $ sudo apt install ffmpeg."; exit 1; }
while true; do
SUCCESS="$(curl "https://user-api.coronatest.nl/vaccinatie/programma/bepaalbaar/$1/NEE/NEE" -sSfA '' --compressed | jq '.success' -cre)"
if [ "$SUCCESS" = "true" ]; then
ffplay "$2" && break
else
echo "$(date -Iseconds): $SUCCESS" && sleep 60
fi
done
@kyranjamie
Copy link

Nice one 👍—I just wrote a node script running in a serverless fn to email me 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment