Parse home and away correctly
This commit is contained in:
parent
2b2861ffd3
commit
31219cfc01
3
.gitignore
vendored
3
.gitignore
vendored
@ -161,3 +161,6 @@ cython_debug/
|
||||
|
||||
|
||||
backup
|
||||
.ipl-data
|
||||
requirements.txt
|
||||
2023
|
||||
|
||||
2
Makefile
2
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:
|
||||
|
||||
12
README.md
12
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
|
||||
|
||||
|
||||
|
||||
20
parse.py
20
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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user