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
|
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
|
.ipl-data/bin/python parse.py 2023/ipl-data-2023.pdf 2023/ipl-data-2023.json
|
||||||
|
|
||||||
2023/ipl-data-2023.pdf:
|
2023/ipl-data-2023.pdf:
|
||||||
|
|||||||
12
README.md
12
README.md
@ -3,7 +3,11 @@
|
|||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Python 3
|
- Python 3
|
||||||
- Some version of Linux
|
- virtualenv
|
||||||
|
- GNU Make
|
||||||
|
- curl
|
||||||
|
- Some flavour of GNU/Linux
|
||||||
|
- Internet connection
|
||||||
|
|
||||||
## Run
|
## Run
|
||||||
|
|
||||||
@ -11,3 +15,9 @@ To get the fixture data for 2023, run
|
|||||||
`make 2023`
|
`make 2023`
|
||||||
|
|
||||||
Output is present in `2023/ipl-data-2023.json`
|
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 tabula
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
import math
|
||||||
|
|
||||||
class Match:
|
class Match:
|
||||||
day_n: int
|
day_n: int
|
||||||
@ -33,15 +34,16 @@ def main():
|
|||||||
x.date = dataframe["Unnamed: 1"][i]
|
x.date = dataframe["Unnamed: 1"][i]
|
||||||
x.time = dataframe["Unnamed: 2"][i]
|
x.time = dataframe["Unnamed: 2"][i]
|
||||||
homeaway = dataframe["Unnamed: 3"][i]
|
homeaway = dataframe["Unnamed: 3"][i]
|
||||||
home = ""
|
away = dataframe["Unnamed: 4"][i]
|
||||||
away = ""
|
if away != away:
|
||||||
for j in teams:
|
for j in teams:
|
||||||
if homeaway.startswith(j):
|
if homeaway.startswith(j):
|
||||||
home = j
|
x.home = j
|
||||||
if homeaway.endswith(j):
|
if homeaway.endswith(j):
|
||||||
away = j
|
x.away = j
|
||||||
x.home = home
|
else:
|
||||||
x.away = away
|
x.home = homeaway
|
||||||
|
x.away = away
|
||||||
x.venue = dataframe["Unnamed: 5"][i]
|
x.venue = dataframe["Unnamed: 5"][i]
|
||||||
teams.append(x.home)
|
teams.append(x.home)
|
||||||
matches.append(x)
|
matches.append(x)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user