From 9500eeefa3aec72e5a41244c326aadf278e63e97 Mon Sep 17 00:00:00 2001 From: Jeff Clarke Date: Tue, 21 Nov 2017 21:43:47 -0500 Subject: [PATCH] handled special cases in ESPN feed, and adjusted formatting of ranking badge. --- MMM-MyScoreboard.css | 12 ++++++------ providers/ESPN.js | 37 +++++++++++++++++++++++++------------ 2 files changed, 31 insertions(+), 18 deletions(-) diff --git a/MMM-MyScoreboard.css b/MMM-MyScoreboard.css index 20b6da9..6c66034 100644 --- a/MMM-MyScoreboard.css +++ b/MMM-MyScoreboard.css @@ -151,8 +151,8 @@ font-size: 12px; font-weight: bold; line-height: 13px; - background-color: #666; - color: #FFF; + background-color: #FFF; + color: #000; padding: 0 2px 0 3px; height: 13px; border-radius: 2px; @@ -171,8 +171,8 @@ line-height: 13px; padding: 0 2px; height: 13px; - background-color: #333; - color: #FFF; + background-color: #FFF; + color: #000; border-radius: 2px; font-weight: bold; } @@ -189,7 +189,7 @@ .MMM-MyScoreboard .wrapper.colored .box-score .logo .ranking, .MMM-MyScoreboard .wrapper.colored .box-score .team-name .ranking, .MMM-MyScoreboard .wrapper.colored .box-score .team-short-code .ranking { - background-color: #37677B; + background-color: #C0FF00; } .MMM-MyScoreboard .wrapper.colored .box-score.in-progress .status { @@ -422,7 +422,7 @@ .MMM-MyScoreboard .box-score.oneLine .team-short-code, .MMM-MyScoreboard .box-score.oneLineWithLogos .team-short-code { - width: 60px; + width: 57px; color: #AAA; } diff --git a/providers/ESPN.js b/providers/ESPN.js index 9e94035..5a14ded 100644 --- a/providers/ESPN.js +++ b/providers/ESPN.js @@ -65,11 +65,14 @@ module.exports = { moment(gameDate).format("YYYYMMDD") + "&limit=200"; /* - by default, ESPN returns only the Top 25 ranked teams for NCAAM. - If we append "&groups=50" (in the URL when you view the scores - on ESPN.com) we get all the games. - */ - if (league == "NCAAM") { + by default, ESPN returns only the Top 25 ranked teams for NCAAF + and NCAAM. By appending the group parameter (80 for NCAAF and 50 + for NCAAM, found in the URL of their respective scoreboard pages + on ESPN.com) we'll get the entire game list. + */ + if (league == "NCAAF") { + url = url + "&groups=80"; + } else if (league == "NCAAM") { url = url + "&groups=50"; } @@ -265,16 +268,26 @@ module.exports = { vTeamData.team.abbreviation = "SDSU "; } + //determine which display name to use + var hTeamLong = ""; + var vTeamLong = ""; + //For college sports, use the displayName property + if (league == "NCAAF" || league == "NCAAM") { + hTeamLong = (hTeamData.team.abbreviation == undefined ? "" : hTeamData.team.abbreviation + " ") + hTeamData.team.name; + vTeamLong = (vTeamData.team.abbreviation == undefined ? "" : vTeamData.team.abbreviation + " ") + vTeamData.team.name; + } else { //use the shortDisplayName property + hTeamLong = hTeamData.team.shortDisplayName; + vTeamLong = vTeamData.team.shortDisplayName; + } + + formattedGamesList.push({ classes: classes, gameMode: gameState, - hTeam: hTeamData.team.abbreviation, - vTeam: vTeamData.team.abbreviation, - /* - For college sports, include the shortcode in the long team name - */ - hTeamLong: (league == "NCAAF" || league == "NCAAM" ? hTeamData.team.abbreviation + " " : "") + hTeamData.team.shortDisplayName, - vTeamLong: (league == "NCAAF" || league == "NCAAM" ? vTeamData.team.abbreviation + " " : "") + vTeamData.team.shortDisplayName, + hTeam: hTeamData.team.abbreviation == undefined ? hTeamData.team.name.substring(0,4).toUpperCase() + " " : hTeamData.team.abbreviation, + vTeam: vTeamData.team.abbreviation == undefined ? vTeamData.team.name.substring(0,4).toUpperCase() + " " : vTeamData.team.abbreviation, + hTeamLong: hTeamLong, + vTeamLong: vTeamLong, hTeamRanking: (league == "NCAAF" || league == "NCAAM") ? self.formatT25Ranking(hTeamData.curatedRank.current) : null, vTeamRanking: (league == "NCAAF" || league == "NCAAM") ? self.formatT25Ranking(vTeamData.curatedRank.current) : null, hScore: parseInt(hTeamData.score),