Add timer

This commit is contained in:
augustin64 2023-12-19 21:54:30 +01:00
parent cfb9d7a0ca
commit f47445775d

View File

@ -10,9 +10,17 @@ DAY="$1"
YEAR="$2" YEAR="$2"
FILENAME="${YEAR}/day${DAY}.py" FILENAME="${YEAR}/day${DAY}.py"
python utils/cli.py download -y $YEAR -d $DAY
python utils/cli.py show -y $YEAR -d $DAY
cp utils/template.py "$FILENAME" cp utils/template.py "$FILENAME"
sed -i "s/DAY/${DAY}/" "$FILENAME" sed -i "s/DAY/${DAY}/" "$FILENAME"
sed -i "s/YEAR/${YEAR}/" "$FILENAME" sed -i "s/YEAR/${YEAR}/" "$FILENAME"
codium "$PWD" "$PWD/$FILENAME"
if [[ $(date +%H) -lt 6 ]]; then
SECONDS_UNTIL_START=$(( $(date -f - +%s- <<< "today 06:00"$'\nnow') 0 ))
echo "Waiting ${SECONDS_UNTIL_START} seconds.."
sleep $SECONDS_UNTIL_START;
fi;
echo "Goooooo !"
python utils/cli.py download -y $YEAR -d $DAY
python utils/cli.py show -y $YEAR -d $DAY