User:Mmd/Augmented Diff
< User:Mmd
Jump to navigation
Jump to search
Test script for downloading augmented diffs
#!/bin/bash
AUG_DIFF_STAT=`curl -s http://overpass-api.de/api/augmented_diff_status`
# the following line for testing purposes only
# replace by own local augmented diff status
CURRENT_ID=$(($AUG_DIFF_STAT-10))
while [ true ] ;
do
# Check if quota if not yet exceeded
curl -s http://overpass-api.de/api/status | grep -q "slots available now"
if [[ $? -ne 0 ]]; then
echo "No slots available"
sleep 10
continue
fi
# get current maximum augmented diff status
NEW_AUG_DIFF_STAT=`curl -s http://overpass-api.de/api/augmented_diff_status`
# May return an empty result in case of error, only consider value if
# larger then current augmented diff status
if [ "$NEW_AUG_DIFF_STAT" -gt "$AUG_DIFF_STAT" ]; then
AUG_DIFF_STAT=$NEW_AUG_DIFF_STAT
echo "New augmented diff status: $AUG_DIFF_STAT"
fi
if [ "$CURRENT_ID" -le "$AUG_DIFF_STAT" ]; then
echo -n "Downloading $CURRENT_ID..."
##########################################################################
# Important: Adjust user agent and include your contact details (email) #
##########################################################################
curl -s --compressed -A "augmented diff downloader test, contact ..@..." http://overpass-api.de/api/augmented_diff?id=$CURRENT_ID -o $CURRENT_ID.osc
if [[ $? -eq 0 ]]; then
echo "Done"
((CURRENT_ID++))
else
echo "Error"
fi
fi
sleep 10
done