#!/bin/bash

set -e

# where to extract the POI files
SRCDIR=/home/files/nobackup/nokia/poi

rm -f $SRCDIR/*
cd $SRCDIR

wget http://www.iki.fi/mk/triffidit_2004.zip
unzip -L triffidit_2004.zip

rm *.txt

# trying to avoid charset problems – the zip seems to contain latin-1 -characters
rename 'y/\344/a/' *
rename 'y/\366/o/' *
rename 'y/\ /_/' *
rename "y/\'/_/" *
rename 'y/Д/a/' *
rename 'y/Ф/o/' *

rm triffidit_2004.zip

chmod 600 *

exit 0

