2021-12-05 15:28:40 +01:00
|
|
|
[[ $1 ]] || set -- $(date +%d)
|
|
|
|
[[ $2 ]] || set -- $1 $(date +%Y)
|
2021-12-01 21:44:27 +01:00
|
|
|
|
2021-12-01 15:29:21 +01:00
|
|
|
if [[ ! -e .git ]]; then
|
|
|
|
echo "Merci de se déplacer dans le répertoire approprié"
|
|
|
|
exit 0
|
|
|
|
fi;
|
|
|
|
|
2021-12-01 21:44:27 +01:00
|
|
|
DAY="$1"
|
|
|
|
YEAR="$2"
|
2021-12-01 15:29:21 +01:00
|
|
|
FILENAME="${YEAR}/day${DAY}.py"
|
|
|
|
|
|
|
|
cp utils/template.py "$FILENAME"
|
|
|
|
sed -i "s/DAY/${DAY}/" "$FILENAME"
|
|
|
|
sed -i "s/YEAR/${YEAR}/" "$FILENAME"
|
2023-12-19 21:54:30 +01:00
|
|
|
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
|