BurntSushi / nflgame

An API to retrieve and read NFL Game Center JSON data. It can work with real-time data, which can be used for fantasy football.
http://pdoc.burntsushi.net/nflgame
The Unlicense
1.27k stars 414 forks source link

idmap as JSON #187

Open bttmly opened 8 years ago

bttmly commented 8 years ago

I'm wondering if a PR would be accepted where the idmap object which is the bulk of statmap.py could be extracted into a standalone JSON file, which statmap.py would then read. The use case here would be to have a file which could be read by any program -- for instance, a GameCenter client in another programming language would be able to easily pull in any changes to the idmap.

The downside I see is that JSON doesn't allow comments, which are nice keep right inline with the map.

Thanks!

BurntSushi commented 8 years ago

I would accept such a PR. Following a similar structure as schedule.json would be good I think.

amac44 commented 8 years ago

Good idea.

bttmly commented 8 years ago

So, turns out I have no idea how the python package system works... I've written the code for this PR, but without a test suite I'm at a loss for how to determine if it works as I expect. I figured I could just create a python script, import nflgame if in the same directory, paste some example code from the readme, and run it, but I'm clearly missing a step. Any pointers?

BurntSushi commented 8 years ago

That sounds fine. The lack of unit tests sucks, so you'll just have to do some manual QA to make sure it works. If you look at how schedule.json is loaded, that should do the trick.