Here’s a module to display today’s scores for your favourite teams across multiple leagues.
UPDATE! Now with MLS Support!!! I was able to find an ESPN feed for this. Very exciting! GO TFC!!!
Display is configurable for your preferred of 6 different view styles:
But Jeff! There are already modules for all these sports! Why did you write this?
Glad you asked! While there are already modules to support many of the sports I am interested in, they all look and behave just a little bit differently. I wanted my scoreboard to have a consistent look across all leagues, and I also wanted the module to hide itself completely if there were no games.
Furthermore, I wanted this to be modular such that adding more leagues would be fairly straightforward. Right now it supports NHL, MLB, NBA, NFL, MLS and CFL (Canadian Football). Pretty much any league with a public API can be added provided it fits with the two team, current score with status (e.g.: current period and game clock, future start time, etc.) format.
So what’s the catch?
My module ONLY displays today’s games. You won’t see yesterday’s scores (well you can with a creative hack using one of the configs… more below), nor will you see a schedule for upcoming games. My thought is you’re not really spending a lot of time looking at your mirror – you’re likely busy doing other stuff, like actually watching the game. But for today’s games that haven’t yet started, it’s a quick reminder that you need to make time later for your obligation to consume professional sport.
What’s this magical hack you speak of?
There is a configuration called
rolloverHoursthat treats x amount of hours past midnight as the previous day. This way your scores don’t mysteriously disappear mid game at midnight (West coast NHL playoff overtime anybody?). Typically you might set this to 2 or 3 hours, but if you set it, say, to
12, then you’ll see yesterday’s finals up until noon, after which you’ll start to see today’s lineup.
Enjoy this module! I’m quite proud of it, and let me know if you’d like to see some other leagues included. I’ve already had a request for pro video game leagues. It’s a little different and poses a bit of a challenge but I’ll see if it can be done.
- could you show us what your "yesterdays’ would look like?
- Is it all teams or just your favourite teams ( if i was to have The peguins and Predators would it show 2 or only 1 time ) Not that, that will ever happen Go WILD !
@sithas Yesterdays will just look like final scores. There’s no indication that they are from yesterday. The display will change to the actual list of today’s games starting later when the rollover time passes.
This module just shows the games for the teams you want to follow. If you want to see all games then you need to put all teams in the follow list. You’ll only see one game listed if both teams are in your follow list.
I have a question/huge favor. I’m trying to add NCAAF to this module. Unfortunately, I have exactly 0.2% experience with js. I can parse the website with Python and get the information I’m looking for, but I do not know how to translate that to js. I have taken your NBA.js and changed it in an attempt to make it work, but I’m sure I’m not even close to where I need to be. When you have a few free moments (i.e. this is not at all an important endeavor), could you look over where I am and point me closer to the right direction? I cannot tell you how much I would appreciate it. (I’ve realized that I cannot upload the text file, but I can copy/paste the code here)
@Spankythemusical I’m travelling this week, but I’ll have a look when I get back next week. Is the Fred a public JSON feed or are you scraping the NCAA website?
Love this module! Does this module allow more than one module to run at a time. I can’t seem to get more than one to run. Config file errors out. Could this feature be added? Why would I need this? I’d like to have one league down the right hand side and one down the left hand side.
@j.e.f.f Thank you. Like I said, it’s not a big thing that needs immediate attention. The feed is a public JSON feed from ESPN.
@Spankythemusical all of the current sports my module supports use public JSON feeds. If you want, take a look at, say, NBA to get an idea how it works.
@P-Bo726 it does not. Since the module takes care of dividing up the sports for you I didn’t see a reason for multiple instances.