I am having trouble with the NHL.com feed that is suppling the scores. The current location where the scores comes from is :
http://live.nhl.com/GameData/Scoreboard.jsonp
The issue that I am seeing is that the scores do not always pull correctly.. For example the site is listing game id 2011021030 which was the Game bvetween NYI and NYR that ended in a OT victory for the Rangers. The pull I made three times in a roll at around 9:20 on the 12th shows this:
"id":2011021030,"startTime":"7:00 PM","boxScoreLink":"http://www.nhl.com/ice/gamecenter.htm?id=2011021030&navid=sb:gamecenter","recapLink":"http://www.nhl.com/ice/recap.htm?id=2011021030&navid=sb:recap","awayTeamId":2,"previewLink":"http://www.nhl.com/ice/preview.htm?id=2011021030&navid=sb:preview","homeTeamId":3,"isFavorite":false,"awayTeamName":"NYI","homeTeamName":"NYR","awayTeamScore":3},{"startDate":"SUN 3/11","progressTime":"","gameImportant":false,"gameState":3,"awayTeamSog":29,"longStartTime":"03/11/2012 20:00:00","videoLink":"http://video.nhl.com/videocenter/console?hlg=20112012,2,1031&fr=false&navid=sb:highlights","isToday":false,"homeTeamSog":37,"period":5,"homeTeamScore":2,
The issue I am having is that the varibale gameState is reporting differently. The current code in the scoreboard.js file is written as such: (Slightly modified by to illustrate the OT / SO state.)
// Determine the game status.
switch (gameState) {
case 0:
status = gameTime.toLowerCase();
break;
case 1:
isActive = true;
status = progress.substring(0, 1).toUpperCase() + progress.substring(1).toLowerCase();
break;
case 2:
isOver = true;
status = "Final";
progress = progress.toUpperCase();
if (progress.indexOf("OT") >= 0)
{
status += "-OT";
isOT = true;
}
else if (progress.indexOf("SO") >= 0)
{
status += "-SO";
isSO = true;
}
break;
default:
status = "n/a";
break;
}
As you can see the gameState is the determining factor in the whole process. As it stands right now the gameState varibale is not reporting anything when listed by NHL.com as '3' - thus it automatically reports as n/a.
Summary: I will have to watch what is being reported through the next week to see what has changed in the way NHL.com reports game scores and try to figure out how to change the code to reflect the new scoring method. Right now, I am not sure if it is a change, or a mistake on their end. I will watch it and see if I can find a patern - but if anyone knows another site like ESPN that is pusing out scores in json or xml format please post it. That might be the only way to finish this thing out.
As far as the updateScores.asp page. I am trying to match up the data from scoresbard.js to the variables in the updateScores.asp page in order to pull the correct data. I have failed miserably several times when editing the functions and have had to start over. I think I am getting somewhere but hit this snag which has slowed me down.
Well, if nothing else - hopefully persistance will pay off soon. Take care Drizz and talk to you soon.
GB