#!/bin/bash -x

# Set base URL
base_url="https://www.predskazanie.ru"
data_url="${base_url}/znacheniya-kart-taro"
jpeg_url="${base_url}/taro-karty"

# Major arcana names
major_names=(
    shut mag zhrica imperatrica imperator
    ierofant vlyublennye kolesnica spravedlivost
    otshelnik koleso-fortuny sila poveshennyi smert
    umerennost diavol bashnya zvezda luna solnce sud mir
)

# Major arcana numbers (roman numerals)
major_numbers=(0 I II III IV V VI VII VIII IX X XI XII XIII XIV XV XVI XVII XVIII XIX XX XXI)


# Download major arcana
for i in {0..21}
do
    echo "Now downloading ${major_names[$i]}"
    wget "${data_url}/${major_names[$i]}.php"
    wget "${jpeg_url}/${major_numbers[$i]}-${major_names[$i]}.jpg" -O "${major_names[$i]}.jpg"
done


# Download minor arcana
for arcana in zhezlov kubkov metchey monet
do
    for number in tuz {2..10} pazh rytsar koroleva korol
    do
        echo "Now downloading ${number} ${arcana}"
        wget "${data_url}/${number}-${arcana}.php"
        wget "${jpeg_url}/${number}-${arcana}.jpg"
    done
done
