Skip to content

Commit 923576b

Browse files
committed
PR Followups
1 parent 05b823a commit 923576b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tools/generate_event_links.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
WEDNESDAY_DATETIME_DAY = 2
99
END_DATE_WEEKS = 4 # Number of weeks to skip
1010

11+
DATE_FORMAT = "%Y-%m-%d"
1112
START_URL_ENCODING = "T03%3A00%3A00-05%3A00" #T03:00:00
1213
END_URL_ENCODING = "T02%3A59%3A00-05%3A00" #T02:59:00
1314
EVENT_TYPES = [
@@ -58,11 +59,11 @@ def get_formatted_dates():
5859
"""
5960

6061
start, end = get_desired_date_range()
61-
start_year, end_year = str(start.year), str(end.year)
62-
start_month, end_month = str(start.month).zfill(2), str(end.month).zfill(2) # left padding with 0s
63-
start_day, end_day = str(start.day).zfill(2), str(end.day).zfill(2) # left padding with 0s
62+
63+
formatted_start = f"{start.strftime(DATE_FORMAT)}{START_URL_ENCODING}"
64+
formatted_end = f"{end.strftime(DATE_FORMAT)}{END_URL_ENCODING}"
6465

65-
return f"{start_year}-{start_month}-{start_day}{START_URL_ENCODING}", f"{end_year}-{end_month}-{end_day}{END_URL_ENCODING}"
66+
return formatted_start, formatted_end
6667

6768
def get_urls():
6869
urls = []
@@ -87,11 +88,13 @@ def main():
8788
urls = get_urls()
8889

8990
# TODO: Auto parse results... For now, generates an HTML page of links to use
91+
CUTOFF_POINT = 160 # Skips all portions of URL up to the location + in-person/online
92+
9093
date_title = str(datetime.datetime.today().strftime("%m_%d_%Y"))
9194
with open(f'{date_title}.html', 'w') as f:
9295
f.write(f'<p>{date_title}</p>\n<br>\n')
9396
for i, url in enumerate(urls):
94-
text_line = url[160:]
97+
text_line = url[CUTOFF_POINT:]
9598
f.write(f'<a href="{url}" target="_blank">{text_line}</a>\n<br>\n<br>\n')
9699

97100
if __name__ == '__main__':

0 commit comments

Comments
 (0)