Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # deskgallica
- # Uso: deskgallica inicio fin ark cooldown
- # Ejemplo: deskgallica f01 f212 ark:/12148/btv1b525132672 30
- inicio=$1
- fin=$2
- ark=$3
- cooldown=$4 # en segundos
- if [ -z "$inicio" ] || [ -z "$fin" ] || [ -z "$ark" ] || [ -z "$cooldown" ]; then
- echo "Uso: $0 inicio fin ark cooldown"
- echo "Ejemplo: $0 f01 f212 ark:/12148/btv1b525132672 30"
- exit 1
- fi
- # Eliminamos el prefijo 'f' para trabajar con números
- inicio_num=${inicio#f}
- fin_num=${fin#f}
- for i in $(seq -f "%03g" $inicio_num $fin_num); do
- filename="f$i.jpg"
- url="https://gallica.bnf.fr/iiif/$ark/f$i/full/full/0/native.jpg"
- if [ ! -s "$filename" ]; then
- echo "Descargando $url..."
- wget -c "$url" -O "$filename"
- else
- echo "Archivo $filename ya existe y tiene tamaño > 0, saltando..."
- fi
- echo "Esperando $cooldown segundos antes del siguiente folio..."
- sleep "$cooldown"
- done
Advertisement
Add Comment
Please, Sign In to add comment