summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/cezar-db-fetch.sh2
-rw-r--r--docs/convert-to-baza2.csv.sql5
2 files changed, 6 insertions, 1 deletions
diff --git a/bin/cezar-db-fetch.sh b/bin/cezar-db-fetch.sh
index 3af7357..cfbc8ab 100755
--- a/bin/cezar-db-fetch.sh
+++ b/bin/cezar-db-fetch.sh
@@ -3,7 +3,7 @@ PAGEDIR=`dirname $0`
DATE=`date --date='yesterday' +%Y%m%d`
OUTPUTFILE=`realpath $PAGEDIR/../data/cezar/$DATE.csv`
TMPFILE=$PAGEDIR/temp
-wget http://msc.com.pl/cezar/download/baza.csv -q -O - | iconv -f windows-1250 -t utf-8 > $TMPFILE
+wget http://msc.com.pl/cezar/download/baza2.csv -q -O $TMPFILE
if [ -s $TMPFILE ]; then
tail -n +2 $TMPFILE | sort > $OUTPUTFILE
echo "Downloaded Cezar CSV into $OUTPUTFILE"
diff --git a/docs/convert-to-baza2.csv.sql b/docs/convert-to-baza2.csv.sql
new file mode 100644
index 0000000..1b62172
--- /dev/null
+++ b/docs/convert-to-baza2.csv.sql
@@ -0,0 +1,5 @@
+ALTER TABLE `players`
+ ADD COLUMN `gender` varchar(1) COLLATE utf8_unicode_520_ci NOT NULL
+ AFTER `region`;
+UPDATE `players` SET `gender` = 'K', `flags` = SUBSTRING(`flags` FROM 2) WHERE flags LIKE 'K%';
+UPDATE `players` SET `gender` = 'M' WHERE gender = '';