-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextract-places-nl-diyanet.sh
executable file
·80 lines (53 loc) · 1.6 KB
/
extract-places-nl-diyanet.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#! /bin/sh
set -e
export HERE=$(dirname $(readlink -f $0))
. ${HERE}/settings.sh
COUNTRY=netherlands
SOURCE=diyanet
extract_data() {
country=${COUNTRY}
county=${SOURCE}
FILE=${TMPDIR}/${country}-${source}.html
mkdir -p ${STORAGE}/${country}-${source}/${MONTH}/${DAY}
cp -f \
${FILE} \
${STORAGE}/${country}-${source}/${MONTH}/${DAY}/${country}-${source}.html
cp -f \
${FILE} \
${WEBDATA}/${country}-${source}.html
}
country=${COUNTRY}
source=${SOURCE}
mkdir -p ${TMPDIR}
cd ${TMPDIR}
FILE=${TMPDIR}/${country}-${source}.html
wget "http://www.diyanet.nl/hdv-cami-hizmetleri/sube-cami-adresleri/" -O ${FILE} \
> ${FILE}.out 2> ${FILE}.err
if [ -a ${FILE} ]
then
if [ -s ${FILE} ]
then
MONTH=$(date +%Y%m --reference ${FILE})
DAY=$(date +%Y%m%d --reference ${FILE})
extract_data
fi
fi
# Copy WEBDATA back to Dropbox
# mkdir -p ${STORAGE}/_data-ditib-nl/
# rsync -ar ${WEBDATA}/ ${STORAGE}/_data-ditib-nl/
country=${COUNTRY}
for country in netherlands
do
:
mkdir -p ${STORAGE}/${country}/${MONTH}/${DAY}
curl -X POST \
"http://localhost:8888/rest/internal/ditib/import-nl" \
-o ${LOGDIR}/curl-ditib-places-${country}-import.txt \
> ${LOGDIR}/curl-ditib-places-${country}-import.out \
2> ${LOGDIR}/curl-ditib-places-${country}-import.err
for x in curl-ditib-places-${country}-import.txt curl-ditib-places-${country}-import.out curl-ditib-places-${country}-import.err
do
mv ${LOGDIR}/${x} ${STORAGE}/${country}/${MONTH}/${DAY}/${x}
done
done
# FINI