def process_odds(favorite, dog, game): if game.moneyline == 'EVEN': favorite = favorite + add_whitespace(game.moneyline, 9) else: favorite = favorite + add_whitespace(game.moneyline[3:].strip(), 9) dog = dog + add_whitespace("O/U:" + str(game.overUnder), 9) return favorite, dog
def process_team(team, state): t = add_whitespace(team.colorful_name(), 14, base=team.name) if state != "pre": runs = add_whitespace(str(team.runs), 3) hits = add_whitespace(str(team.hits), 3) errors = add_whitespace(str(team.errors), 3) return t + runs + hits + errors else: return t
def process_team(team, state): t = add_whitespace(team.colorful_name(), 33, base=team.name) if state != 'pre': if team.winner: score = add_whitespace(custom_background( (255, 255, 255)) + custom_text_color( (0, 0, 0)) + str(team.score) + ENDC, 3, base=str(team.score)) else: score = add_whitespace(str(team.score), 3) return t + score else: return t + ' '
def process(game1): event_info = [] # top line if game1.description in ['Delayed', 'Final']: game_detail = game1.description + "/" + str(game1.period) else: game_detail = game1.detail mid_line = process_team(game1.awayTeam, game1.state) bottom_line = process_team(game1.homeTeam, game1.state) if game1.state != 'pre': game_detail = add_whitespace(game_detail, 14) + "R H E " else: game_detail = game1.date if game1.hasOdds: if game1.awayTeam.abbrev in game1.moneyline: mid_line, bottom_line = process_odds(mid_line, bottom_line, game1) elif game1.homeTeam.abbrev in game1.moneyline: bottom_line, mid_line = process_odds(bottom_line, mid_line, game1) elif game1.moneyline == 'EVEN': mid_line, bottom_line = process_odds(mid_line, bottom_line, game1) elif game1.moneyline == ' ': mid_line = add_whitespace( mid_line, 23, base=line_length(mid_line, game1.awayTeam)) bottom_line = add_whitespace( bottom_line, 23, base=line_length(bottom_line, game1.homeTeam)) top_line = add_whitespace(game_detail, 23) top_line, mid_line, bottom_line = ball_strike_out( top_line, mid_line, bottom_line, game1) top_line, mid_line, bottom_line = bases_loaded( top_line, mid_line, bottom_line, game1) event_info.append(top_line) event_info.append(mid_line) event_info.append(bottom_line) link = add_whitespace(game1.link, 36) event_info.append(link) return event_info