diff options
author | Markus Koch <markus@notsyncing.net> | 2021-11-02 16:45:22 +0100 |
---|---|---|
committer | Markus Koch <markus@notsyncing.net> | 2021-11-02 16:45:22 +0100 |
commit | 4625d4e25b5ebe98acc2bad69bed95dccd6037fd (patch) | |
tree | 1daab9d447ed275b543e05b2eda0e60ef2a424e2 /scripts/convert_latest.sh | |
parent | 50d9ee43b0baf5ce6be688aa7ea8932fb67242d5 (diff) | |
download | lifomapserver-4625d4e25b5ebe98acc2bad69bed95dccd6037fd.tar.gz lifomapserver-4625d4e25b5ebe98acc2bad69bed95dccd6037fd.tar.bz2 lifomapserver-4625d4e25b5ebe98acc2bad69bed95dccd6037fd.zip |
scripts: Modify map script to download and convert all available maps
Diffstat (limited to 'scripts/convert_latest.sh')
-rwxr-xr-x | scripts/convert_latest.sh | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/scripts/convert_latest.sh b/scripts/convert_latest.sh deleted file mode 100755 index 8e9bd42..0000000 --- a/scripts/convert_latest.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/bash - -MAPSERVER='https://lifomaps.de' -TILESERVER="notsyncing.net:/srv/http/maps.linux-forks.de/tiles/" -OUTDIR=`pwd`/out -SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" - -FILE=`curl "$MAPSERVER" | sed -n 's/.*>\(world-[0-9\-]\+\.png\).*/\1/p' | tail -n 1` - -if [[ "$FILE" == "" ]]; then - echo "ERROR: Could not detect latest map file." - exit -fi - -if [[ -f "$OUTDIR/uploaded" ]]; then - echo "INFO: Latest map has already been converted." - exit -fi - -REMOTE_URL="$MAPSERVER/$FILE" -LOCAL_URL="$OUTDIR/$FILE" -MAPNAME=`echo $LOCAL_URL | sed 's/.*\/\([^\.]\+\).*/\1/g'` - -echo "# Downloading and converting $MAPNAME." - -mkdir -p $OUTDIR -cd $OUTDIR - -if [ ! -f "$OUTDIR/converted" ]; then - echo "Downloading latest map file..." - curl -C - "$REMOTE_URL" -o "$LOCAL_URL" - - echo "Resizing map..." - OSIZE=`file $LOCAL_URL | sed -n 's/.*PNG image data, \([0-9]\+\).*/\1/p'` - NSIZE=$((2**6 * 256)) - RESIZED_URL="$LOCAL_URL-resized.png" - convert $LOCAL_URL -extent ${NSIZE}x${NSIZE} -gravity NorthWest $RESIZED_URL - - echo "Converting map..." - $SCRIPT_DIR/convert_maps.sh $MAPNAME $RESIZED_URL - - echo "" > $OUTDIR/converted -fi - -echo "Uploading files..." - -scp -r $OUTDIR/$MAPNAME $TILESERVER -echo "" > $OUTDIR/uploaded - -echo "Cleaning up..." -read -rm $RESIZED_URL -rm $LOCAL_URL |