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