sports bug fixes

This commit is contained in:
Neythen Treloar 2022-02-28 20:46:20 +00:00
parent e929435fd9
commit 9ef4042d23

View File

@ -1547,6 +1547,7 @@ class StockTicker():
filepath = 'csv/{}_games.json'.format(time)
else:
print(time)
filepath = 'csv/upcoming_games.json'
@ -1570,7 +1571,7 @@ class StockTicker():
x_offset = 0
img = Image.new('RGB', (10000, 32))
league_info = json.load(open('csv/sports/{}/{}_games.json'.format(league, time), 'r'))
league_info = leagues_info[league]
try:
@ -1580,28 +1581,20 @@ class StockTicker():
except:
pass
small_font = ImageFont.load("./fonts/5x7.pil")
med_font = ImageFont.load("./fonts/7x14B.pil")
large_font = ImageFont.load("./fonts/9x18B.pil")
sports_info = self.readSportsCSV(league)
print(sports_info)
buff_size = 25
for match in league_info[-15:]:
for match in league_info:
home_team = match['home_team']
away_team = match['away_team']
if time != 'future':
home_score = match['home_score']
away_score = match['away_score']
@ -1636,6 +1629,7 @@ class StockTicker():
if time == 'future':
img.paste(date_timage, (x_offset+5, 0))
h_colour = mcolors.to_rgb(sports_info[home_team]['colour'].replace(' ', ''))
a_colour = mcolors.to_rgb(sports_info[away_team]['colour'].replace(' ', ''))
@ -1694,7 +1688,7 @@ class StockTicker():
img = img.crop((0,0,x_offset ,32))
imgs.append(img)
except Exception as e:
raise e
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
self.logf.write(str(e))
@ -1724,6 +1718,7 @@ class StockTicker():
imgs = []
for league in leagues:
try:
x_offset = 0
@ -2450,7 +2445,7 @@ class StockTicker():
team_info[row[0]]['code'] = row[2]
team_info[row[0]]['logo'] = row[4]
team_info[row[0]]['colour'] = row[3]
f.close()
return team_info
def displayDailyWeatherAlt(self):
@ -2757,7 +2752,7 @@ if __name__ == '__main__':
#stock_ticker.process_msg('-')
#stock_ticker.process_msg('W')
#stock_ticker.process_msg('A')
stock_ticker.process_msg('A')
@ -2765,7 +2760,7 @@ if __name__ == '__main__':
msg = getInput()
stock_ticker.process_msg(msg)
except Exception as e:
raise e
exc_type, exc_obj, exc_tb = sys.exc_info()
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
log.write(str(e))