summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2017-06-07 02:25:52 +0200
committeremkael <emkael@tlen.pl>2017-06-07 02:25:52 +0200
commit742f0e753e3968d00ca795706dc622c41ab576a9 (patch)
treed0390d9ec5b75660edfca7fae86601ba5b2ed599
parentddc20f684c75e060a642f4e0481bea32aab53d65 (diff)
Helper script for fetching Cezar players DB
-rwxr-xr-xbin/fetch-cezar-db.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/bin/fetch-cezar-db.sh b/bin/fetch-cezar-db.sh
new file mode 100755
index 0000000..839e07c
--- /dev/null
+++ b/bin/fetch-cezar-db.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+PAGEDIR=`dirname $0`
+DATE=`date --date='yesterday' +%Y%m%d`
+OUTPUTFILE=`realpath $PAGEDIR/../data/cezar/$DATE.csv`
+wget http://msc.com.pl/cezar/download/baza.csv -q -O - | iconv -f windows-1250 -t utf-8 > temp
+if [ -s temp ]; then
+ tail -n +2 temp | sort > $OUTPUTFILE
+ echo "Downloaded Cezar CSV into $OUTPUTFILE"
+else
+ echo 'Cezar CSV fetch failed'
+fi
+rm temp