soccer-cli icon indicating copy to clipboard operation
soccer-cli copied to clipboard

Convert leagues to JSON, add league lookup

Open thurask opened this issue 8 years ago • 1 comments

Continuing from #83, replace the league*.py files with leagues.json, which is similar in structure to teams.json.

...
      "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
    },
...

Rewrite main.py and writers.py to accomodate.

As well, add league codes to the --list arg, like so: soccer1

Lastly, extend --lookup arg to work for leagues as well, in the spirit of #85.

$ soccer --league BL2 --lookup
2. Bundesliga

thurask avatar Apr 21 '16 22:04 thurask

Okay, found some bugs with the initial commit. Had to move JSON loading into jsonhandler.py, then have main.py and writers.py work from there. Otherwise we'd get cyclical imports and other bad stuff.

As a result, this works not just with python main.py, but also regular old soccer.

thurask avatar Apr 22 '16 23:04 thurask