diff --git a/MLB-Menu/MLB-Menu-Info.plist b/MLB-Menu/MLB-Menu-Info.plist index 45a5b77..fab78aa 100644 --- a/MLB-Menu/MLB-Menu-Info.plist +++ b/MLB-Menu/MLB-Menu-Info.plist @@ -32,6 +32,13 @@ Copyright © 2013 Syntaxi. All rights reserved. NSMainNibFile MainMenu + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + CFBundleDisplayName + NSPrincipalClass NSApplication diff --git a/MLB-Menu/SYNAppDelegate.m b/MLB-Menu/SYNAppDelegate.m index 46a6174..e2aa5e5 100644 --- a/MLB-Menu/SYNAppDelegate.m +++ b/MLB-Menu/SYNAppDelegate.m @@ -38,7 +38,10 @@ -(IBAction)updateGames:(id)sender { localtime_r(¤tTime, &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]; } diff --git a/MLB-Menu/SYNGameViewController.m b/MLB-Menu/SYNGameViewController.m index 847753c..ffc01d9 100644 --- a/MLB-Menu/SYNGameViewController.m +++ b/MLB-Menu/SYNGameViewController.m @@ -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]; } } } diff --git a/MLB-Menu/SYNGameViewController.xib b/MLB-Menu/SYNGameViewController.xib index 4754711..4f18e97 100644 --- a/MLB-Menu/SYNGameViewController.xib +++ b/MLB-Menu/SYNGameViewController.xib @@ -1,602 +1,69 @@ - - - 1070 - 12C3012 - 3084 - 1187.34 - 625.00 - - com.apple.InterfaceBuilder.CocoaPlugin - 3084 - - - IBNSLayoutConstraint - NSCustomObject - NSCustomView - NSImageCell - NSImageView - NSSegmentedCell - NSSegmentedControl - - - com.apple.InterfaceBuilder.CocoaPlugin - - - PluginDependencyRecalculationVersion - - - - - SYNGameViewController - - - FirstResponder - - - NSApplication - - - - 268 - - - - 268 - - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - {{143, 4}, {35, 35}} - - - - _NS:9 - YES - - 134217728 - 33554432 - _NS:9 - 0 - 0 - 0 - NO - - NO - YES - - - - 268 - {{37, 11}, {104, 20}} - - - - _NS:9 - YES - - 603979776 - 33554432 - - LucidaGrande - 12 - 4883 - - _NS:9 - - - - 24 - - 0 - - - 48 - 0 - - - 24 - 0 - - - -1 - 2 - 3 - - NO - - - - 268 - - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - {{0, 4}, {35, 35}} - - - - _NS:9 - YES - - 134217728 - 33554432 - _NS:9 - 0 - 0 - 0 - NO - - NO - YES - - - {178, 42} - - - - _NS:9 - SYNGameView - - - - - - - view - - - - 21 - - - - away - - - - 47 - - - - scoreBox - - - - 61 - - - - home - - - - 98 - - - - controller - - - - 22 - - - - - - 0 - - - - - - -2 - - - File's Owner - - - -1 - - - First Responder - - - -3 - - - Application - - - 3 - - - - - 6 - 0 - - 6 - 1 - - 0.0 - - 1000 - - 8 - 29 - 3 - - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 5 - 22 - 2 - - - - 3 - 0 - - 3 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 10 - 0 - - 10 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 4 - 0 - - 4 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 10 - 0 - - 10 - 1 - - 0.0 - - 1000 - - 5 - 22 - 2 - - - - 5 - 0 - - 5 - 1 - - 0.0 - - 1000 - - 8 - 29 - 3 - - - - - - - Game - - - 5 - - - - - - 8 - 0 - - 0 - 1 - - 35 - - 1000 - - 3 - 9 - 1 - - - - 7 - 0 - - 0 - 1 - - 35 - - 1000 - - 3 - 9 - 1 - - - - - - 17 - - - - - 49 - - - - - - - - 50 - - - - - 78 - - - - - 86 - - - - - - 7 - 0 - - 0 - 1 - - 35 - - 1000 - - 3 - 9 - 1 - - - - - - 88 - - - - - 121 - - - - - 125 - - - - - 131 - - - - - 133 - - - - - 134 - - - - - 137 - - - - - 138 - - - - - 139 - - - - - 140 - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - - 140 - - - - - NSLayoutConstraint - NSObject - - IBProjectSource - ./Classes/NSLayoutConstraint.h - - - - SYNGameView - NSView - - controller - SYNGameViewController - - - controller - - controller - SYNGameViewController - - - - IBProjectSource - ./Classes/SYNGameView.h - - - - SYNGameViewController - NSViewController - - NSImageView - NSImageView - NSTableView - NSSegmentedControl - - - - away - NSImageView - - - home - NSImageView - - - mediaSources - NSTableView - - - scoreBox - NSSegmentedControl - - - - IBProjectSource - ./Classes/SYNGameViewController.h - - - - - 0 - IBCocoaFramework - - com.apple.InterfaceBuilder.CocoaPlugin.macosx - - - YES - 3 - YES - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +