From d90d54eb25c326364575d062543664a214506210 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 1 Jul 2020 21:18:23 +0200 Subject: [PATCH 1/1] De-hardcode infections table path from enhance_table.py. --- enhance_table.py | 8 +++++++- update.sh | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/enhance_table.py b/enhance_table.py index 11f65eb..2b6bb8d 100755 --- a/enhance_table.py +++ b/enhance_table.py @@ -1,5 +1,11 @@ #!//usr/bin/env python3 +import sys +if len(sys.argv) != 2: + print('Expecting infections table file path as only argument.') + exit(1) +infections_table = sys.argv[1] + # District population numbers as per Wikipedia. district_pops = { 'CW': 342332, @@ -17,7 +23,7 @@ district_pops = { 'sum': 3754418, } -f = open('daily_infections_table.txt', 'r') +f = open(infections_table, 'r') lines = f.readlines() f.close() diff --git a/update.sh b/update.sh index f1b7467..1bfd38b 100755 --- a/update.sh +++ b/update.sh @@ -18,4 +18,4 @@ curl "${CSV_URL}" \ 'END { printf "\n" }' "${filename}" >> "${table_path}" # Write enhanced table output to directory served by web server. -./enhance_table.py > /var/www/html/berlin_corona.txt +./enhance_table.py "${table_path}" > /var/www/html/berlin_corona.txt -- 2.30.2