Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Commit

Permalink
adapt to new naming scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
srehwald committed Jan 13, 2018
1 parent 3863392 commit b87604d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/menu_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b87604d

Please sign in to comment.