// STATUS [ July 11, 2019 ] : this works /// <summary> /// Launch Baseball Savant page for player /// </summary> /// <param name="player">todo: describe player parameter on LaunchPlayersBaseballSavantPageInChrome</param> public void LaunchPlayersBaseballSavantPageInChrome(SfbbPlayerBase player) { int? mlbId = player.MLBID; string urlString = $"https://baseballsavant.mlb.com/savant-player/{mlbId}"; C.WriteLine($"SAVANT: {urlString}"); Process.Start("open", urlString); }
// STATUS [ July 11, 2019 ] : this works /// <summary> /// Launch Yahoo page for player /// </summary> /// <param name="player">todo: describe player parameter on LaunchPlayersYahooPageInChrome</param> public void LaunchPlayersYahooPageInChrome(SfbbPlayerBase player) { string playerYahooId = player.YAHOOID; string urlString = $"https://sports.yahoo.com/mlb/players/{playerYahooId}/"; C.WriteLine($"YAHOO: {urlString}"); Process.Start("open", urlString); }
// STATUS [ July 11, 2019 ] : this works /// <summary> /// Launch Rotowire page for player /// </summary> /// <param name="player">todo: describe player parameter on LaunchPlayersRotowirePageInChrome</param> public void LaunchPlayersRotowirePageInChrome(SfbbPlayerBase player) { string playerRotowireId = player.ROTOWIREID; string urlString = $"https://www.rotowire.com/baseball/player.php?id={playerRotowireId}"; C.WriteLine($"ROTOWIRE: {urlString}"); Process.Start("open", urlString); }
// STATUS [ July 11, 2019 ] : this works /// <summary> /// Launch Baseball Prospectus page for player /// </summary> /// <param name="player">todo: describe player parameter on LaunchPlayersBaseballProsectusPageInChrome</param> public void LaunchPlayersBaseballProsectusPageInChrome(SfbbPlayerBase player) { string playerBaseballProspectusId = player.BPID; string urlString = $"https://legacy.baseballprospectus.com/card/{playerBaseballProspectusId}/"; C.WriteLine($"BB PROSPECTUS: {urlString}"); Process.Start("open", urlString); }
// STATUS [ July 11, 2019 ] : this works /// <summary> /// Launch FanGraphs page for player /// </summary> /// <param name="player">todo: describe player parameter on LaunchPlayersFanGraphsPageInChrome</param> public static void LaunchPlayersFanGraphsPageInChrome(SfbbPlayerBase player) { string playerFanGraphsId = player.IDFANGRAPHS; string urlString = $"https://www.fangraphs.com/statss.aspx?playerid={playerFanGraphsId}"; C.WriteLine($"FG: {urlString}"); Process.Start("open", urlString); }
// STATUS [ July 11, 2019 ] : this works /// <summary> /// Launch Baseball Reference page /// </summary> /// <param name="player">todo: describe player parameter on LaunchPlayersBaseballReferencePageInChrome</param> public void LaunchPlayersBaseballReferencePageInChrome(SfbbPlayerBase player) { string baseballReferenceId = player.BREFID; string lastNameFirstLetter = player.LASTNAME.Substring(0, 1).ToLower(CultureInfo.CurrentCulture); string urlString = $"https://www.baseball-reference.com/players/{lastNameFirstLetter}/{baseballReferenceId}.shtml"; C.WriteLine($"BREF: {urlString}"); Process.Start("open", urlString); }
// STATUS [ July 11, 2019 ] : this works /// <summary> /// Launch Baseball HQ page for player /// </summary> /// <param name="player">todo: describe player parameter on LaunchPlayersBaseballHqPageInChrome</param> public void LaunchPlayersBaseballHqPageInChrome(SfbbPlayerBase player) { int? playerBaseballHqId = player.HQID; string playerPosition = player.POS; // the urls are slightly different for pitchers and hitters string linkType; linkType = string.Equals(playerPosition, "P", StringComparison.Ordinal) ? "pitcherlink" : "batterlink"; string urlString = $"https://www.baseballhq.com/members/tools/{linkType}/?id={playerBaseballHqId}"; C.WriteLine($"HQ: {urlString}"); Process.Start("open", urlString); }
// STATUS [ July 11, 2019 ] : this works // [ August 29, 2019 ] : made tweaks and haven't tested /// <summary> /// Launch all websites for an individual in Google Chrome /// Sites include: /// * FanGraphs /// * Baseball Prospectus /// * Rotowire /// * Baseball Savant /// * Baseball HQ /// * Yahoo /// </summary> /// <param name="firstName">todo: describe firstName parameter on LaunchAllPagesInChromeForPlayer</param> /// <param name="lastName">todo: describe lastName parameter on LaunchAllPagesInChromeForPlayer</param> /// <remarks> /// Uses google sheet connector /// See: gSheetNames.json for sheet info /// Relies on SfbbPlayerIdMap to pull various ids for the player /// </remarks> /// <example> /// LaunchAllPagesInChromeForPlayer("tyler","chatwood"); /// </example> public void LaunchAllPagesInChromeForPlayer(string firstName, string lastName) { firstName = FormatPlayerFirstAndLastName(firstName); // capitalize first letter if needed lastName = FormatPlayerFirstAndLastName(lastName); // capitalize first letter if needed string playerName = $"{firstName} {lastName}"; IEnumerable <SfbbPlayerBase> allPlayerBases = _playerBaseController.GetAll_GSheet("A7:AQ2284"); IEnumerable <SfbbPlayerBase> onePlayerBase = from playerBases in allPlayerBases where string.Equals( playerBases.FANGRAPHSNAME, playerName, StringComparison.Ordinal ) select playerBases; int nullCheck = onePlayerBase.Count(); if (nullCheck == 0) { PrintNullPlayerBase(firstName, lastName); } else { SfbbPlayerBase player = onePlayerBase.First(); LaunchPlayersFanGraphsPageInChrome(player); LaunchPlayersBaseballProsectusPageInChrome(player); LaunchPlayersRotowirePageInChrome(player); LaunchPlayersBaseballSavantPageInChrome(player); LaunchPlayersBaseballHqPageInChrome(player); LaunchPlayersYahooPageInChrome(player); LaunchPlayersBaseballReferencePageInChrome(player); } }