mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-30 03:46:29 -05:00
Counting successful map tile fetches.
This commit is contained in:
parent
c2ca5fb3b3
commit
95b3ec3ad2
1 changed files with 29 additions and 6 deletions
|
|
@ -49,14 +49,37 @@ done
|
|||
# If we've made it through all attempts, curl never succeeded
|
||||
if [[ $i -eq $ATTEMPTS ]]; then
|
||||
echo "Failed to fetch the image after $ATTEMPTS attempts."
|
||||
echo " You can try resetting your map using /opt/wrolpi/scripts/reset_map.sh then importing a map again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Fetching first map tile succeeded."
|
||||
|
||||
curl -ks \
|
||||
"${HOST}/hot/3/{0..7}/{0..7}.png" \
|
||||
"${HOST}/hot/4/{0..15}/{0..15}.png" \
|
||||
"${HOST}/hot/5/{0..31}/{0..31}.png" \
|
||||
"${HOST}/hot/6/{0..41}/{0..41}.png" >/dev/null 2>&1
|
||||
echo "Fetching many map tiles completed."
|
||||
|
||||
# Function to fetch and count downloads
|
||||
fetch_and_count() {
|
||||
local level=$1
|
||||
local max_x=$2
|
||||
local max_y=$3
|
||||
|
||||
local success_count=0
|
||||
local failure_count=0
|
||||
|
||||
for x in $(seq 0 $max_x); do
|
||||
for y in $(seq 0 $max_y); do
|
||||
if wget -q --spider --no-check-certificate "${HOST}/hot/${level}/${x}/${y}.png"; then
|
||||
((success_count++))
|
||||
else
|
||||
((failure_count++))
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
echo "Level $level - Successful downloads: $success_count"
|
||||
}
|
||||
|
||||
# Fetch all tiles from each level so the map is ready to use.
|
||||
fetch_and_count 3 7 7
|
||||
fetch_and_count 4 15 15
|
||||
fetch_and_count 5 31 31
|
||||
fetch_and_count 6 41 41
|
||||
Loading…
Add table
Add a link
Reference in a new issue