Friday, April 8, 2016

Honus: fixing for 2016 part 2

The highlights used to come from the highlights.xml page, but this year there is only highlights_es.xml. I fixed it with a couple lines of code as below

$addif2016 = "";
if ($year >= 2016) {
$addif2016 = "_es";
}
$filename = "http://gd2.mlb.com/components/game/mlb/year_{$year}/month_{$month}/day_{$day}/gid_{$year}_{$month}_{$day}_{$away_code}mlb_{$home_code}mlb_1/media/highlights{$addif2016}.xml";
There is surely an easier way to do it but my PHP is very rusty and this works. Turns out the "_es" means that the titles are all in Spanish. I have no clue why they stopped putting up an English version. I think I can use the mobile.xml page to get the highlights with English headlines, but there may be other issues that come up. I'll leave this for later. So http://honus-1064.appspot.com/ is up and running for the 2016 season. Although it looks like there is a problem with it going to tomorrow, instead of today by default. I'll fix this later, but for now you can just change the date using the calendar.

No comments:

Post a Comment