Skip to content

Commit

Permalink
download-collection script
Browse files Browse the repository at this point in the history
  • Loading branch information
cquest committed Jun 18, 2023
1 parent 43b56d5 commit 36418c5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
9 changes: 9 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 25 additions & 0 deletions scripts/download-collection
Original file line number Diff line number Diff line change
@@ -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'


0 comments on commit 36418c5

Please sign in to comment.