Git Product home page Git Product logo

Comments (4)

WardBrian avatar WardBrian commented on June 16, 2024 2

I have a mostly-working version of this locally. There are some oddities, e.g. Columbia is also abbreviated COL, so it ends up purple.

Here's the relevant code:

                games = statsapi.schedule(self.date.strftime("%Y-%m-%d"))

                # WBC - Id 51 is "International Baseball"
                games += statsapi.schedule(sportId="51", date=self.date.strftime("%Y-%m-%d"))

                # sort and de-duplicate
                sorted_games = sorted(
                    games, key=lambda a: datetime.strptime(a["game_datetime"], "%Y-%m-%dT%H:%M:%SZ")
                )
                latest = None
                self.__all_games = []
                for game in sorted_games:
                    if game["game_id"] != latest:
                        self.__all_games.append(game)
                        latest = game["game_id"]

which you can replace this line:

self.__all_games = statsapi.schedule(self.date.strftime("%Y-%m-%d"))

with, if you'd like. I'm not sure if we will support this "officially" or not, since it's a limited time thing and only every 4 years

from mlb-led-scoreboard.

jshaddo avatar jshaddo commented on June 16, 2024 1

I've implemented this piece of code in the schedule.py file. Everything seems to pick up the WBC games. I need to work through shortening some of the longer names and adding custom colors for the international teams. Thanks again!

from mlb-led-scoreboard.

WardBrian avatar WardBrian commented on June 16, 2024

We can get "International Baseball" easily by requesting sportId 51 in the schedule API call, but this will include duplicates of the exhibition games (e.g., on Thursday the Cardinals are playing Nicaragua) which are also listed in the normal MLB listing (sportId 1).

I can't figure out if there's a way to request only the WBC games, it seems requesting leagueId:160 has no effect.

There would need to be a few other changes to e.g. teams.py, and obviously there wouldn't be built-in colors for them either

from mlb-led-scoreboard.

ty-porter avatar ty-porter commented on June 16, 2024

With the WBC over, I think we can close this.

from mlb-led-scoreboard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.