diff --git a/.gitignore b/.gitignore index d9f7ebd..a70a966 100644 --- a/.gitignore +++ b/.gitignore @@ -161,3 +161,6 @@ cython_debug/ backup +.ipl-data +requirements.txt +2023 diff --git a/Makefile b/Makefile index 25194e6..cec9561 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -2023: .ipl-data/.c-install 2023/ipl-data-2023.pdf +2023: .ipl-data/.c-install 2023/ipl-data-2023.pdf parse.py .ipl-data/bin/python parse.py 2023/ipl-data-2023.pdf 2023/ipl-data-2023.json 2023/ipl-data-2023.pdf: diff --git a/README.md b/README.md index 19d2a87..9484fca 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,11 @@ ## Requirements - Python 3 -- Some version of Linux +- virtualenv +- GNU Make +- curl +- Some flavour of GNU/Linux +- Internet connection ## Run @@ -11,3 +15,9 @@ To get the fixture data for 2023, run `make 2023` Output is present in `2023/ipl-data-2023.json` + +> The fixture is hosted as a PDF at documents.bcci.tv. It will be automatically downloaded to `2023/ipl-data-2023.pdf' as part of program execution and is not explicitly distributed as part of this project. + +## Releases + + diff --git a/parse.py b/parse.py index 12b3f7f..f04ab99 100644 --- a/parse.py +++ b/parse.py @@ -1,6 +1,7 @@ import tabula import json import sys +import math class Match: day_n: int @@ -33,15 +34,16 @@ def main(): x.date = dataframe["Unnamed: 1"][i] x.time = dataframe["Unnamed: 2"][i] homeaway = dataframe["Unnamed: 3"][i] - home = "" - away = "" - for j in teams: - if homeaway.startswith(j): - home = j - if homeaway.endswith(j): - away = j - x.home = home - x.away = away + away = dataframe["Unnamed: 4"][i] + if away != away: + for j in teams: + if homeaway.startswith(j): + x.home = j + if homeaway.endswith(j): + x.away = j + else: + x.home = homeaway + x.away = away x.venue = dataframe["Unnamed: 5"][i] teams.append(x.home) matches.append(x)