X-Git-Url: https://plomlompom.com/repos/?p=berlin-corona-table;a=blobdiff_plain;f=update.sh;h=fee5ef593c4b4f2ea1e6fb6e77a8d7b41f917a53;hp=ace8592a60902c614e510a2b6020621981b734f2;hb=HEAD;hpb=0c72202485d4042624ee6523c0c751c73d031a7d diff --git a/update.sh b/update.sh index ace8592..fee5ef5 100755 --- a/update.sh +++ b/update.sh @@ -1,21 +1,10 @@ #!/bin/sh set -e -CSV_URL=https://www.berlin.de/lageso/_assets/gesundheit/publikationen/corona/bezirkstabelle.csv table_path=daily_infections_table.txt -# If we don't have a table file yet, we need to provide its header. -header=" CW FK Li MH Mi Ne Pa Re Sp SZ TS TK sum" -if [ ! -f "${table_path}" ]; then - echo "${header}" > "${table_path}" -fi - -# Parse Lageso day table of new infections by district into new line for history table. -today="$(date +%Y-%m-%d)" -curl "${CSV_URL}" \ -| awk 'BEGIN { FS=";"; ORS=""; print "'${today}'" }; '\ -'!/^Bezirk/ { printf "%4d", $3 }; '\ -'END { printf "\n" }' "${filename}" >> "${table_path}" +# Re-build infections table. +./scrape.py > "${table_path}" # Write enhanced table output to directory served by web server. #