Template
1
0

fix second display and do things in a more sensible order

This commit is contained in:
Stefan Harmuth 2023-12-01 06:32:08 +01:00
parent 5ce83dfafc
commit cab9cfe529

View File

@ -29,11 +29,6 @@ if exists(day_file):
print(day_file, "already exists. Use that one!") print(day_file, "already exists. Use that one!")
exit() exit()
with open("skel_day.py", "r") as IN:
with open(day_file, "w") as OUT:
while in_line := IN.readline():
OUT.write(in_line.replace("%YEAR%", str(YEAR)).replace("%DAY%", str(DAY)))
start = datetime(YEAR, 12, DAY, 6, 0, 0) start = datetime(YEAR, 12, DAY, 6, 0, 0)
now = datetime.now() now = datetime.now()
if start > now: if start > now:
@ -43,9 +38,14 @@ if start > now:
exit() exit()
for x in range(time_wait.seconds, -1, -1): for x in range(time_wait.seconds, -1, -1):
print("Day starts in %02ds.\r") print("Day starts in %02ds.\r" % x)
sleep(1) sleep(1)
call([CHARMS[system()], day_file]) with open("skel_day.py", "r") as IN:
webbrowser.open("https://adventofcode.com/%d/day/%d" % (YEAR, DAY)) with open(day_file, "w") as OUT:
while in_line := IN.readline():
OUT.write(in_line.replace("%YEAR%", str(YEAR)).replace("%DAY%", str(DAY)))
call(["git", "add", day_file]) call(["git", "add", day_file])
webbrowser.open("https://adventofcode.com/%d/day/%d" % (YEAR, DAY))
call([CHARMS[system()], day_file])