sports bug fixes
This commit is contained in:
parent
e929435fd9
commit
9ef4042d23
@ -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:
|
||||
@ -1579,31 +1580,23 @@ class StockTicker():
|
||||
x_offset += league_logo.size[0] +self.blank.size[0]
|
||||
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']
|
||||
|
||||
home_score = match['home_score']
|
||||
away_score = match['away_score']
|
||||
if time != 'future':
|
||||
home_score = match['home_score']
|
||||
away_score = match['away_score']
|
||||
|
||||
date = match['date'].replace('-', '.')
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1788,7 +1783,7 @@ class StockTicker():
|
||||
img = img.crop((0,0,x_offset ,32))
|
||||
imgs.append(img)
|
||||
except Exception as 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))
|
||||
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user