Jakeukalane

deskgallica

Feb 13th, 2026
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # deskgallica
  4. # Uso: deskgallica inicio fin ark cooldown
  5. # Ejemplo: deskgallica f01 f212 ark:/12148/btv1b525132672 30
  6.  
  7. inicio=$1
  8. fin=$2
  9. ark=$3
  10. cooldown=$4 # en segundos
  11.  
  12. if [ -z "$inicio" ] || [ -z "$fin" ] || [ -z "$ark" ] || [ -z "$cooldown" ]; then
  13. echo "Uso: $0 inicio fin ark cooldown"
  14. echo "Ejemplo: $0 f01 f212 ark:/12148/btv1b525132672 30"
  15. exit 1
  16. fi
  17.  
  18. # Eliminamos el prefijo 'f' para trabajar con números
  19. inicio_num=${inicio#f}
  20. fin_num=${fin#f}
  21.  
  22. for i in $(seq -f "%03g" $inicio_num $fin_num); do
  23. filename="f$i.jpg"
  24. url="https://gallica.bnf.fr/iiif/$ark/f$i/full/full/0/native.jpg"
  25.  
  26. if [ ! -s "$filename" ]; then
  27. echo "Descargando $url..."
  28. wget -c "$url" -O "$filename"
  29. else
  30. echo "Archivo $filename ya existe y tiene tamaño > 0, saltando..."
  31. fi
  32.  
  33. echo "Esperando $cooldown segundos antes del siguiente folio..."
  34. sleep "$cooldown"
  35. done
  36.  
Advertisement
Add Comment
Please, Sign In to add comment