#!/bin/bash

sequential=false
if [ "$1" == "-s" ]; then
    sequential=true
fi

# Populate array of months we care about
months=()
# 2020
for i in {7..12}; do
    months+=( 2020-$(printf %02d $i) )
done
# 2021
for i in {1..4}; do
    months+=( 2021-$(printf %02d $i) )
done

# Extract the data for each month
if [ "$sequential" != "true" ]; then
    # Do it in parallel
    for i in ${months[@]}; do
        ./scripts/extract-extra-infos-archive.sh bridge-extra-infos-${i}.tar.xz &
    done

    # Wait until we're done extracting everything
    wait
else
    for i in ${months[@]}; do
        ./scripts/extract-extra-infos-archive.sh bridge-extra-infos-${i}.tar.xz
    done
fi
