Skip to content

Commit

Permalink
Hopefully get set for 2019
Browse files Browse the repository at this point in the history
  • Loading branch information
markolson committed Mar 28, 2019
1 parent 73ea700 commit fc81067
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 612 deletions.
7 changes: 7 additions & 0 deletions MLB-Menu/MLB-Menu-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
<string>Copyright © 2013 Syntaxi. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>CFBundleDisplayName</key>
<string></string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
Expand Down
5 changes: 4 additions & 1 deletion MLB-Menu/SYNAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ -(IBAction)updateGames:(id)sender {
localtime_r(&currentTime, &timeStruct);
char buffer[26];
strftime(buffer, 26, "year_%Y/month_%m/day_%d", &timeStruct);
NSString *url = [NSString stringWithFormat:@"http://mlb.mlb.com/gdcross/components/game/mlb/%s/grid.json", buffer];
// /gdcross/components/game/mlb/year_" + yyyy + "/month_" + mm + "/day_" + dd + "/grid.json
// http://gd2.mlb.com/components/game/mlb/year_2019/month_03/day_28/master_scoreboard.json
NSString *url = [NSString
stringWithFormat:@"http://mlb.mlb.com/gdcross/components/game/mlb/%s/master_scoreboard.json", buffer];
[self parseURL:url];
}

Expand Down
20 changes: 10 additions & 10 deletions MLB-Menu/SYNGameViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,24 @@ -(void)setRaw:(NSDictionary *)_raw {
raw = _raw;
[home setImage:[NSImage imageNamed:[NSString stringWithFormat:@"%@.png", raw[@"home_file_code"]]]];
[away setImage:[NSImage imageNamed:[NSString stringWithFormat:@"%@.png", raw[@"away_file_code"]]]];
if([raw[@"status"] isEqualToString:@"Scheduled"] || [raw[@"status"] isEqualToString:@"Preview"] || [raw[@"status"] isEqualToString:@"Pre-Game"] || [raw[@"status"] isEqualToString:@"Warmup"]) {
if([raw[@"status"][@"status"] isEqualToString:@"Scheduled"] || [raw[@"status"][@"status"] isEqualToString:@"Preview"] || [raw[@"status"][@"status"] isEqualToString:@"Pre-Game"] || [raw[@"status"][@"status"] isEqualToString:@"Warmup"]) {
[scoreBox setSegmentCount:1];
[scoreBox setLabel:raw[@"event_time"] forSegment:0];
[scoreBox setLabel:[NSString stringWithFormat:@"%@ %@", raw[@"home_time"], raw[@"home_time_zone"]] forSegment:0];
[scoreBox setWidth:96 forSegment:0];
}else if ([raw[@"status"] isEqualToString:@"Delayed Start"] || [raw[@"status"] isEqualToString:@"Delayed"] || [raw[@"status"] isEqualToString:@"Cancelled"] || [raw[@"status"] isEqualToString:@"Postponed"]) {
}else if ([raw[@"status"][@"status"] isEqualToString:@"Delayed Start"] || [raw[@"status"][@"status"] isEqualToString:@"Delayed"] || [raw[@"status"][@"status"] isEqualToString:@"Cancelled"] || [raw[@"status"][@"status"] isEqualToString:@"Postponed"]) {
[scoreBox setSegmentCount:1];
[scoreBox setLabel:[NSString stringWithFormat:@"%@", raw[@"status"]] forSegment:0];
[scoreBox setLabel:[NSString stringWithFormat:@"%@", raw[@"status"][@"status"]] forSegment:0];
[scoreBox setWidth:96 forSegment:0];
}else{
[scoreBox setLabel:raw[@"away_score"] forSegment:0];
[scoreBox setLabel:raw[@"home_score"] forSegment:2];
if([raw[@"status"] isEqualToString:@"In Progress"]) {
NSString *tb = ([raw[@"top_inning"] isEqualToString:@"Y"]) ? @"" : @"";
[scoreBox setLabel:raw[@"linescore"][@"r"][@"away"] forSegment:0];
[scoreBox setLabel:raw[@"linescore"][@"r"][@"home"] forSegment:2];
if([raw[@"status"][@"status"] isEqualToString:@"In Progress"]) {
NSString *tb = ([raw[@"status"][@"inning_state"] isEqualToString:@"Top"]) ? @"" : @"";
[scoreBox setLabel:[NSString stringWithFormat:@"%@%@ %@", raw[@"inning"], [self ordinalFor:raw[@"inning"]], tb] forSegment:1];
}else if([raw[@"status"] isEqualToString:@"Final"] || [raw[@"status"] isEqualToString:@"Game Over"]) {
}else if([raw[@"status"][@"status"] isEqualToString:@"Final"] || [raw[@"status"][@"status"] isEqualToString:@"Game Over"]) {
[scoreBox setLabel:@"Final" forSegment:1];
}else {
[scoreBox setLabel:[NSString stringWithFormat:@"%@", raw[@"status"]] forSegment:1];
[scoreBox setLabel:[NSString stringWithFormat:@"%@", raw[@"status"][@"status"]] forSegment:1];
}
}
}
Expand Down
Loading

0 comments on commit fc81067

Please sign in to comment.