From 19435b1d99c94a06459d6fb62e3f2b35085d0d25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20P=C3=A9rez-Cerezo?= Date: Wed, 15 Apr 2020 01:08:31 +0200 Subject: Fancy icons, shops, stations Added fancy actions (TODO: include script to install) * added fetcher script for shops * added fetcher script for stations * fixed thumbnails --- scripts/geojson/fetch_single.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'scripts/geojson/fetch_single.sh') diff --git a/scripts/geojson/fetch_single.sh b/scripts/geojson/fetch_single.sh index 61ab79d..e669f68 100755 --- a/scripts/geojson/fetch_single.sh +++ b/scripts/geojson/fetch_single.sh @@ -1,9 +1,11 @@ #!/bin/bash - -json=`curl "https://wiki.linux-forks.de/mediawiki/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=$1&rvsection=0&rvslots=main" | sed -s "s/\\\\\\\\n//g"` +json=`curl "https://wiki.linux-forks.de/mediawiki/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=$1&rvsection=0&rvslots=main" 2>/dev/null | sed -s "s/\\\\\\\\n//g"` title=`echo $json | sed -n 's/.*"title":\s*"\([^"]\+\).*/\1/p'` -image=`echo "$json" | sed -n "s/.*image = \([^|]*\).*/\1/p"` + +img=$(curl "https://wiki.linux-forks.de/mediawiki/index.php/$1" 2>/dev/null | sed s/\"/\\n/g | grep /thumb/ | head -n 1) + +image="https://wiki.linux-forks.de$img" coords=`echo "$json" | sed -n "s/.*coordinates = {{Co|\([^}]*\).*/\1/p"` coord_x=`echo "$coords" | sed -n "s/\([^|]\+\).*/\1/p"` @@ -19,7 +21,7 @@ if [[ "$coord_x" != "" && "$coord_y" != "" ]]; then \"name\": \"$title\",\ \"amenity\": \"City\",\ \"description\": \"$description\",\ - \"image\": \"https://wiki.linux-forks.de/mediawiki/images/thumb/0/0e/$image/250px-$image\"\ + \"image\": \"$image\"\ },\ \"geometry\": {\ \"type\": \"Point\",\ -- cgit v1.2.3