download-collection script

This commit is contained in:
Christian Quest
2023-06-18 15:51:50 +02:00
parent 43b56d55ae
commit 36418c57b3
2 changed files with 34 additions and 0 deletions

View File

@@ -8,3 +8,12 @@ Usage: ./blurdir directory-path
Will create a "blur" directory in the original directory to store the blurred version of the pictures with the same name as original pictures.
## download-collection
Downloads all pictures in a sequence/collection
Usage: ./download-collection collection-url
Exemple: ./download-collection https://panoramax.openstreetmap.fr/api/collections/90d9c033-bfc2-411c-9769-622dfb0e7431
A directory is created to store the pictures, named with the timestamp of the first picture in the sequence and pictures are named with their timestamp,

25
scripts/download-collection Executable file
View File

@@ -0,0 +1,25 @@
#! /bin/bash
IFS=$'\n'
mkdir -p $(basename $1)
cd $(basename $1)
JSON=collection.json
echo "Retrieving collection items list"
curl -sl $1/items > $JSON
echo "$(jq .features[].properties.datetime $JSON | wc -l) pictures to download"
for P in $(jq .features[] $JSON -c)
do
URL=$(echo $P | jq .assets.hd.href -r)
TS=$(echo $P | jq .properties.datetime -r)
curl -sl $URL > tmp.jpg
mv tmp.jpg $TS.jpg
echo -n '.'
done
echo ""
cd ..; mv $(basename $1) $(jq -r .features[0].properties.datetime $(basename $1)/$JSON)
echo 'Done'