new golf formatting prof display (espn)
This commit is contained in:
parent
bb0825d5d7
commit
b01ab720c1
199
stockTicker.py
199
stockTicker.py
@ -4087,19 +4087,30 @@ class StockTicker():
|
|||||||
season = match['season']
|
season = match['season']
|
||||||
|
|
||||||
if (time != 'future') and (league != 'LIV'):
|
if (time != 'future') and (league != 'LIV'):
|
||||||
golf_standings1 = match['golf_standings'][::2]
|
golf_standings1 = match['golf_rankings'][::2]
|
||||||
golf_standings2 = match['golf_standings'][1::2]
|
golf_standings2 = match['golf_rankings'][1::2]
|
||||||
elif (time!= 'future') and (league == 'LIV'):
|
elif (time!= 'future') and (league == 'LIV'):
|
||||||
golf_standings1 = match['golf_standings'][0][::2]
|
golf_standings1 = match['golf_rankings'][::2]
|
||||||
golf_standings2 = match['golf_standings'][0][1::2]
|
golf_standings2 = match['golf_rankings'][1::2]
|
||||||
golf_standings1_teams = match['golf_standings'][1][::2]
|
|
||||||
golf_standings2_teams = match['golf_standings'][1][1::2]
|
|
||||||
|
|
||||||
img.paste(league_logo2, (x_offset, 0))
|
img.paste(league_logo2, (x_offset, 0))
|
||||||
x_offset += league_logo2.size[0] + 5
|
x_offset += league_logo2.size[0] + 5
|
||||||
|
try:
|
||||||
|
if match['purse'] != 'N/A' and match['purse'] != "" and match['purse'] != '0':
|
||||||
|
purse_timage = self.textImage(match['purse'], small_font, r=0,g=255,b=0)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if match['shots_par'] != 'N/A' and match['shots_par'] != "" and match['shots_par'] != 0:
|
||||||
|
par_timage = self.textImage('Par' + str(match['shots_par']), small_font, r=255,g=127,b=80)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if match['total_yards'] != 'N/A' and match['total_yards'] != "" and match['total_yards'] != 0:
|
||||||
|
yards_timage = self.textImage(str(match['total_yards']) + 'yds', small_font, r=255,g=127,b=80)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
if time == 'future':
|
if time == 'future':
|
||||||
|
|
||||||
event_timage = self.textImage(event, small_font, r=255, g=255, b=0)
|
event_timage = self.textImage(event, small_font, r=255, g=255, b=0)
|
||||||
venue_timage = self.textImage(venue, small_font, r=0, g=255, b=0)
|
venue_timage = self.textImage(venue, small_font, r=0, g=255, b=0)
|
||||||
city_timage = self.textImage(city, small_font, r=255, g=255, b=255)
|
city_timage = self.textImage(city, small_font, r=255, g=255, b=255)
|
||||||
@ -4107,25 +4118,50 @@ class StockTicker():
|
|||||||
season1_timage = self.textImage('Season:', small_font, r=0, g=170, b=255)
|
season1_timage = self.textImage('Season:', small_font, r=0, g=170, b=255)
|
||||||
season_timage = self.textImage(season, small_font, r=255, g=255, b=255)
|
season_timage = self.textImage(season, small_font, r=255, g=255, b=255)
|
||||||
date1_timage = self.textImage('Date:', small_font, r=255, g=0, b=171)
|
date1_timage = self.textImage('Date:', small_font, r=255, g=0, b=171)
|
||||||
|
|
||||||
#event
|
#event
|
||||||
img.paste(event_timage, (x_offset, 1))
|
img.paste(event_timage, (x_offset, 1))
|
||||||
#venue
|
#venue
|
||||||
img.paste(venue_timage,(x_offset, 9))
|
img.paste(venue_timage,(x_offset, 9))
|
||||||
x_offset += (max(event_timage.size[0], venue_timage.size[0]) + 5)
|
x_offset += (max(event_timage.size[0], venue_timage.size[0]) + 5)
|
||||||
|
x_offset_2nd = x_offset
|
||||||
#date
|
#date
|
||||||
img.paste(date1_timage, (x_offset, 1))
|
img.paste(date1_timage, (x_offset, 1))
|
||||||
img.paste(date_timage, (x_offset + date1_timage.size[0] + 2, 1))
|
x_offset += date1_timage.size[0]
|
||||||
|
img.paste(date_timage, (x_offset, 1))
|
||||||
|
x_offset += date_timage.size[0] + 5
|
||||||
#city
|
#city
|
||||||
img.paste(city_timage,(x_offset, 9))
|
img.paste(city_timage,(x_offset_2nd, 9))
|
||||||
|
x_offset_2nd += city_timage.size[0] + 7
|
||||||
#country
|
#country
|
||||||
img.paste(country_timage,(x_offset + city_timage.size[0] + 7,9))
|
img.paste(country_timage,(x_offset_2nd,9))
|
||||||
|
x_offset_2nd += country_timage.size[0] + 5
|
||||||
#season
|
#season
|
||||||
img.paste(season1_timage,(x_offset + date1_timage.size[0] + 2 + date_timage.size[0] + 5,1))
|
img.paste(season1_timage,(x_offset,1))
|
||||||
img.paste(season_timage,(x_offset + date1_timage.size[0] + 2 + date_timage.size[0] + season1_timage.size[0] + 5,1))
|
x_offset += season1_timage.size[0]
|
||||||
|
img.paste(season_timage,(x_offset,1))
|
||||||
x_offset += max(date1_timage.size[0] + 2 + date_timage.size[0] + season1_timage.size[0] + 5 + season_timage.size[0], city_timage.size[0] + 7 + country_timage.size[0])
|
x_offset += season_timage.size[0] + 5
|
||||||
|
try:
|
||||||
|
if match['purse'] != 'N/A' and match['purse'] != "" and match['purse'] != '0':
|
||||||
|
img.paste(purse_timage, (x_offset, 1))
|
||||||
|
x_offset += purse_timage.size[0] + 5
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if match['total_yards'] != 'N/A' and match['total_yards'] != "" and match['total_yards'] != 0:
|
||||||
|
img.paste(yards_timage, (x_offset_2nd, 9))
|
||||||
|
x_offset_2nd += yards_timage.size[0] + 5
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if match['shots_par'] != 'N/A' and match['shots_par'] != "" and match['shots_par'] != 0:
|
||||||
|
img.paste(par_timage, (x_offset_2nd, 9))
|
||||||
|
x_offset_2nd += par_timage.size[0] + 5
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
x_offset = max(x_offset, x_offset_2nd)
|
||||||
|
#x_offset += max(date1_timage.size[0] + 2 + date_timage.size[0] + season1_timage.size[0] + 5 + season_timage.size[0], city_timage.size[0] + 7 + country_timage.size[0])
|
||||||
x_offset += (buff_size - 10)
|
x_offset += (buff_size - 10)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
event_timage = self.textImage(event, small_font, r=255, g=255, b=0)
|
event_timage = self.textImage(event, small_font, r=255, g=255, b=0)
|
||||||
venue_timage = self.textImage(venue, small_font, r=0, g=255, b=0)
|
venue_timage = self.textImage(venue, small_font, r=0, g=255, b=0)
|
||||||
@ -4134,65 +4170,102 @@ class StockTicker():
|
|||||||
season1_timage = self.textImage('Season:', small_font, r=0, g=170, b=255)
|
season1_timage = self.textImage('Season:', small_font, r=0, g=170, b=255)
|
||||||
season_timage = self.textImage(season, small_font, r=255, g=255, b=255)
|
season_timage = self.textImage(season, small_font, r=255, g=255, b=255)
|
||||||
date1_timage = self.textImage('Date:', small_font, r=255, g=0, b=171)
|
date1_timage = self.textImage('Date:', small_font, r=255, g=0, b=171)
|
||||||
|
|
||||||
#event
|
#event
|
||||||
img.paste(event_timage, (x_offset, 1))
|
img.paste(event_timage, (x_offset, 1))
|
||||||
#venue
|
#venue
|
||||||
img.paste(venue_timage,(x_offset, 9))
|
img.paste(venue_timage,(x_offset, 9))
|
||||||
x_offset += (max(event_timage.size[0], venue_timage.size[0]) + 5)
|
x_offset += (max(event_timage.size[0], venue_timage.size[0]) + 5)
|
||||||
|
x_offset_2nd = x_offset
|
||||||
#date
|
#date
|
||||||
img.paste(date1_timage, (x_offset, 1))
|
img.paste(date1_timage, (x_offset, 1))
|
||||||
img.paste(date_timage, (x_offset + date1_timage.size[0] + 2, 1))
|
x_offset += date1_timage.size[0]
|
||||||
|
img.paste(date_timage, (x_offset, 1))
|
||||||
|
x_offset += date_timage.size[0] + 5
|
||||||
#city
|
#city
|
||||||
img.paste(city_timage,(x_offset, 9))
|
img.paste(city_timage,(x_offset_2nd, 9))
|
||||||
|
x_offset_2nd += city_timage.size[0] + 7
|
||||||
#country
|
#country
|
||||||
img.paste(country_timage,(x_offset + city_timage.size[0] + 7,9))
|
img.paste(country_timage,(x_offset_2nd,9))
|
||||||
|
x_offset_2nd += country_timage.size[0] + 5
|
||||||
#season
|
#season
|
||||||
img.paste(season1_timage,(x_offset + date1_timage.size[0] + 2 + date_timage.size[0] + 5,1))
|
img.paste(season1_timage,(x_offset,1))
|
||||||
img.paste(season_timage,(x_offset + date1_timage.size[0] + 2 + date_timage.size[0] + season1_timage.size[0] + 5,1))
|
x_offset += season1_timage.size[0]
|
||||||
|
img.paste(season_timage,(x_offset,1))
|
||||||
x_offset += max(date1_timage.size[0] + 2 + date_timage.size[0] + season1_timage.size[0] + 5 + season_timage.size[0], city_timage.size[0] + 7 + country_timage.size[0])
|
x_offset += season_timage.size[0] + 5
|
||||||
x_offset2 = x_offset
|
try:
|
||||||
|
if match['purse'] != 'N/A' and match['purse'] != "" and match['purse'] != '0':
|
||||||
for each_player in golf_standings1:
|
img.paste(purse_timage, (x_offset, 1))
|
||||||
|
x_offset += purse_timage.size[0] + 5
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if match['total_yards'] != 'N/A' and match['total_yards'] != "" and match['total_yards'] != 0:
|
||||||
|
img.paste(yards_timage, (x_offset_2nd, 9))
|
||||||
|
x_offset_2nd += yards_timage.size[0] + 5
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
if match['shots_par'] != 'N/A' and match['shots_par'] != "" and match['shots_par'] != 0:
|
||||||
|
img.paste(par_timage, (x_offset_2nd, 9))
|
||||||
|
x_offset_2nd += par_timage.size[0] + 5
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
x_offset = max(x_offset, x_offset_2nd)
|
||||||
|
#x_offset += max(date1_timage.size[0] + 2 + date_timage.size[0] + season1_timage.size[0] + 5 + season_timage.size[0], city_timage.size[0] + 7 + country_timage.size[0])
|
||||||
symbol1_timage = self.textImage('|', small_font, r=255, g=255, b=0)
|
symbol1_timage = self.textImage('|', small_font, r=255, g=255, b=0)
|
||||||
img.paste(symbol1_timage, (x_offset + 5, 1))
|
for each_player, each_player2 in zip(golf_standings1, golf_standings2):
|
||||||
golf_standings1_timage = self.textImage(each_player, small_font, r=255, g=255, b=255)
|
img.paste(symbol1_timage, (x_offset, 1))
|
||||||
img.paste(golf_standings1_timage, (x_offset + symbol1_timage.size[0] + 7, 1))
|
img.paste(symbol1_timage, (x_offset, 9))
|
||||||
x_offset += (golf_standings1_timage.size[0] + symbol1_timage.size[0] + 7)
|
x_offset += symbol1_timage.size[0] + 2
|
||||||
|
golf1_offset = 0
|
||||||
|
golf2_offset = 0
|
||||||
|
try:
|
||||||
|
golf1_rank_timage = self.textImage(each_player['rank'], small_font, r=255, g=255, b=255)
|
||||||
|
img.paste(golf1_rank_timage,(x_offset, 1))
|
||||||
|
golf1_offset += golf1_rank_timage.size[0] + 2
|
||||||
|
try:
|
||||||
|
golf1_country = Image.open('logos/ufc_countries/{}'.format(each_player['country'].split('/')[-1].split('&')[0]))
|
||||||
|
golf1_country.thumbnail((9000,9))
|
||||||
|
img.paste(golf1_country,(golf1_offset + x_offset, -1))
|
||||||
|
golf1_offset += golf1_country.size[0] + 2
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
golf_standings1_timage = self.textImage(each_player['name'] + ' ' + each_player['score'], small_font, r=255, g=255, b=255)
|
||||||
|
img.paste(golf_standings1_timage, (x_offset + golf1_offset, 1))
|
||||||
|
golf1_offset += golf_standings1_timage.size[0]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
golf2_rank_timage = self.textImage(each_player2['rank'], small_font, r=255, g=255, b=255)
|
||||||
|
golf2_offset += golf2_rank_timage.size[0] + 2
|
||||||
|
img.paste(golf2_rank_timage,(x_offset, 9))
|
||||||
|
try:
|
||||||
|
golf2_country = Image.open('logos/ufc_countries/{}'.format(each_player2['country'].split('/')[-1].split('&')[0]))
|
||||||
|
golf2_country.thumbnail((9000,9))
|
||||||
|
img.paste(golf2_country,(x_offset + golf2_offset, 7))
|
||||||
|
golf2_offset += golf2_country.size[0] + 2
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
golf_standings2_timage = self.textImage(each_player2['name'] + ' ' + each_player2['score'], small_font, r=255, g=255, b=255)
|
||||||
|
img.paste(golf_standings2_timage, (x_offset + golf2_offset, 9))
|
||||||
|
golf2_offset += golf_standings2_timage.size[0]
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
x_offset += max(golf2_offset, golf1_offset) + 5
|
||||||
|
# for each_player in golf_standings1:
|
||||||
|
# symbol1_timage = self.textImage('|', small_font, r=255, g=255, b=0)
|
||||||
|
# img.paste(symbol1_timage, (x_offset + 5, 1))
|
||||||
|
# golf_standings1_timage = self.textImage(each_player, small_font, r=255, g=255, b=255)
|
||||||
|
# img.paste(golf_standings1_timage, (x_offset + symbol1_timage.size[0] + 7, 1))
|
||||||
|
# x_offset += (golf_standings1_timage.size[0] + symbol1_timage.size[0] + 7)
|
||||||
|
#
|
||||||
|
# for each_player2 in golf_standings2:
|
||||||
|
# symbol2_timage = self.textImage('|', small_font, r=255, g=255, b=0)
|
||||||
|
# img.paste(symbol2_timage, (x_offset2 + 5, 9))
|
||||||
|
# golf_standings2_timage = self.textImage(each_player2, small_font, r=255, g=255, b=255)
|
||||||
|
# img.paste(golf_standings2_timage, (x_offset2 + symbol2_timage.size[0] + 7, 9))
|
||||||
|
# x_offset2 += (golf_standings2_timage.size[0] + symbol2_timage.size[0] + 7)
|
||||||
|
|
||||||
for each_player2 in golf_standings2:
|
|
||||||
symbol2_timage = self.textImage('|', small_font, r=255, g=255, b=0)
|
|
||||||
img.paste(symbol2_timage, (x_offset2 + 5, 9))
|
|
||||||
golf_standings2_timage = self.textImage(each_player2, small_font, r=255, g=255, b=255)
|
|
||||||
img.paste(golf_standings2_timage, (x_offset2 + symbol2_timage.size[0] + 7, 9))
|
|
||||||
x_offset2 += (golf_standings2_timage.size[0] + symbol2_timage.size[0] + 7)
|
|
||||||
|
|
||||||
if league == 'LIV':
|
|
||||||
if x_offset >= x_offset2:
|
|
||||||
x_offset += 5
|
|
||||||
x_offset2 = x_offset
|
|
||||||
else:
|
|
||||||
x_offset2 += 5
|
|
||||||
x_offset = x_offset2
|
|
||||||
|
|
||||||
for each_team in golf_standings1_teams:
|
|
||||||
symbol1_timage = self.textImage('|', small_font, r=0, g=255, b=0)
|
|
||||||
img.paste(symbol1_timage, (x_offset + 5, 1))
|
|
||||||
golf_standings1_timage = self.textImage(each_team, small_font, r=255, g=255, b=255)
|
|
||||||
img.paste(golf_standings1_timage, (x_offset + symbol1_timage.size[0] + 7, 1))
|
|
||||||
x_offset += (golf_standings1_timage.size[0] + symbol1_timage.size[0] + 7)
|
|
||||||
for each_team2 in golf_standings2_teams:
|
|
||||||
symbol2_timage = self.textImage('|', small_font, r=0, g=255, b=0)
|
|
||||||
img.paste(symbol2_timage, (x_offset2 + 5, 9))
|
|
||||||
golf_standings2_timage = self.textImage(each_team2, small_font, r=255, g=255, b=255)
|
|
||||||
img.paste(golf_standings2_timage, (x_offset2 + symbol2_timage.size[0] + 7, 9))
|
|
||||||
x_offset2 += (golf_standings2_timage.size[0] + symbol2_timage.size[0] + 7)
|
|
||||||
|
|
||||||
if x_offset >= x_offset2:
|
|
||||||
x_offset += (buff_size - 10)
|
|
||||||
else:
|
|
||||||
x_offset = x_offset2
|
|
||||||
x_offset += (buff_size - 10)
|
x_offset += (buff_size - 10)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user