From b87604d84631ccc9924d908bbcbcbdc65a050b52 Mon Sep 17 00:00:00 2001 From: Simon Rehwald Date: Sat, 13 Jan 2018 22:12:03 +0100 Subject: [PATCH] adapt to new naming scheme --- src/menu_parser.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/menu_parser.py b/src/menu_parser.py index 21af936f4e..7e00201979 100644 --- a/src/menu_parser.py +++ b/src/menu_parser.py @@ -167,10 +167,12 @@ def parse(self, location): if pdf_url is None: return None - # Example PDF-name: Garching-Speiseplan_KW46_2017.pdf pdf_name = pdf_url.split("/")[-1] year = int(pdf_name.split("_")[-1].split(".")[0]) - week_number = int(pdf_name.split("_")[2].replace("KW","").lstrip("0")) + # old naming scheme: Garching_Speiseplan_KW46_2017.pdf + # week_number = int(pdf_name.split("_")[2].replace("KW","").lstrip("0")) + # new naming scheme: Garching_Speiseplan_KW_46_2017.pdf + week_number = int(pdf_name.split("_")[3].replace("KW","").lstrip("0")) with tempfile.NamedTemporaryFile() as temp_pdf: # download pdf