Parse home and away correctly

This commit is contained in:
surya 2023-05-21 12:16:52 +05:30
parent 2b2861ffd3
commit 31219cfc01
4 changed files with 26 additions and 11 deletions

3
.gitignore vendored
View File

@ -161,3 +161,6 @@ cython_debug/
backup
.ipl-data
requirements.txt
2023

View File

@ -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:

View File

@ -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

View File

@ -1,6 +1,7 @@
import tabula
import json
import sys
import math
class Match:
day_n: int
@ -33,14 +34,15 @@ def main():
x.date = dataframe["Unnamed: 1"][i]
x.time = dataframe["Unnamed: 2"][i]
homeaway = dataframe["Unnamed: 3"][i]
home = ""
away = ""
away = dataframe["Unnamed: 4"][i]
if away != away:
for j in teams:
if homeaway.startswith(j):
home = j
x.home = j
if homeaway.endswith(j):
away = j
x.home = home
x.away = j
else:
x.home = homeaway
x.away = away
x.venue = dataframe["Unnamed: 5"][i]
teams.append(x.home)