aboutsummaryrefslogtreecommitdiff
path: root/bin/upload.sh
blob: 4fef024c86f4a9fe6dcf9e9a83ee1c8d0f7288fb (plain) (blame)
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
#!/bin/bash

set -e

mkdir -p uploadLog

IMPORT_DOC="https://wiki.openstreetmap.org/wiki/Imports/Vicmap_Address"

i=0
totalFiles=`ls -1 dist/candidates/newAddressesInBlocksWithoutAnyExisting/*.osm | wc -l`
categoryMessage="New addresses in blocks without any existing addresses"
stage="Stage 3"
for f in dist/candidates/newAddressesInBlocksWithoutAnyExisting/*.osm; do
    i=$(($i + 1))
    d=`dirname "$f"`
    b=`basename "$f" .osm`
    id=`echo "$b" | cut -d'_' -f1`
    name=`echo "$b" | cut -d'_' -f2`

    echo "$i/$totalFiles $id: $name"

    echo "   to osc"
	./upload/osm2change.py "$f"

    if [ ! -e "$d/$b.osc" ] ; then
        echo "$d/$b.osc not found"
        echo '$f' >> uploadLog/oscNotFound.txt
    else
        echo "   upload"
        ./upload/upload.py \
            -u 'vicmap_import' \
            -p "${OSM_DEV_PASSWORD}" \
            -c yes \
            -m "Vicmap Address Import - $stage - $categoryMessage: $name. See $IMPORT_DOC" \
            -y 'Vicmap Address' \
            "$d/$b.osc"
        echo "$f" >> uploadLog/uploaded.txt
    fi

    # give the api a rest
    sleep 1s

    # stop after first, used during testing
    exit
done