Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,12 @@ $ soccer --help

For a full list of supported team and team codes [see this](soccer/teams.json).

A list of league and team codes is also available with:

```bash
$ soccer --list
```

Demo
====

Expand Down
15 changes: 15 additions & 0 deletions soccer/jsonhandler.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
import json

def load_json(file):
"""Load JSON file at app start"""
here = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(here, file)) as jfile:
data = json.load(jfile)
return data

TEAM_DATA = load_json("teams.json")["teams"]
TEAM_NAMES = {team["code"]: team["id"] for team in TEAM_DATA}
LEAGUE_DATA = load_json("leagues.json")["leagues"]
LEAGUE_IDS = {league["code"]: league["id"] for league in LEAGUE_DATA}
LEAGUE_PROPERTIES = {league["code"]: league["properties"] for league in LEAGUE_DATA if league["properties"] != "null"}
15 changes: 0 additions & 15 deletions soccer/leagueids.py

This file was deleted.

62 changes: 0 additions & 62 deletions soccer/leagueproperties.py

This file was deleted.

238 changes: 238 additions & 0 deletions soccer/leagues.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
{
"leagues":[
{
"properties":{
"cl":[
1,
3
],
"el":[
4,
4
],
"rl":[
19,
20
]
},
"name":"Ligue 1",
"code":"FL",
"id":396
},
{
"properties":{
"cl":[
1,
2
],
"el":[
3,
6
],
"rl":[
21,
24
]
},
"name":"League One",
"code":"EL1",
"id":425
},
{
"properties":{
"cl":[
1,
3
],
"el":[
4,
5
],
"rl":[
17,
18
]
},
"name":"Primeira Liga",
"code":"PPL",
"id":402
},
{
"properties":{
"cl":[
1,
2
],
"el":[
3,
6
],
"rl":[
19,
22
]
},
"name":"Segunda Division",
"code":"SD",
"id":400
},
{
"properties":{
"cl":[
1,
4
],
"el":[
5,
5
],
"rl":[
18,
20
]
},
"name":"Premier League",
"code":"EPL",
"id":398
},
{
"properties":{
"cl":[
1,
3
],
"el":[
4,
5
],
"rl":[
18,
20
]
},
"name":"Serie A",
"code":"SA",
"id":401
},
{
"properties":{
"cl":[
1,
2
],
"el":[
3,
3
],
"rl":[
18,
20
]
},
"name":"3. Liga",
"code":"BL3",
"id":403
},
{
"properties":{
"cl":[
1,
4
],
"el":[
5,
6
],
"rl":[
18,
20
]
},
"name":"La Liga",
"code":"LLIGA",
"id":399
},
{
"properties":{
"cl":[
1,
2
],
"el":[
3,
3
],
"rl":[
16,
18
]
},
"name":"2. Bundesliga",
"code":"BL2",
"id":395
},
{
"properties":{
"cl":[
1,
3
],
"el":[
0,
0
],
"rl":[
18,
20
]
},
"name":"Ligue 2",
"code":"FL2",
"id":397
},
{
"properties":{
"cl":[
1,
4
],
"el":[
5,
6
],
"rl":[
16,
18
]
},
"name":"Bundesliga",
"code":"BL",
"id":394
},
{
"properties":{
"cl":[
1,
2
],
"el":[
3,
3
],
"rl":[
16,
18
]
},
"name":"Eredivisie",
"code":"DED",
"id":404
},
{
"properties":"null",
"name":"Champions League",
"code":"CL",
"id":405
}
]
}
Loading