Created
June 5, 2021 18:19
-
-
Save bwbroersma/f5810c0237346ef2694b96c04d1f5968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice one 👍—I just wrote a node script running in a serverless fn to email me 😂