display away team first, home team after
This commit is contained in:
parent
efd5f30381
commit
643004e0fd
184
stockTicker.py
184
stockTicker.py
@ -2115,11 +2115,11 @@ class StockTicker():
|
||||
except Exception as e:
|
||||
away_logo = self.textImage(strAwayTeam.replace(' ', '\n'), extra_small_font, r = 255, g = 255, b = 255)
|
||||
|
||||
img.paste(home_logo, (x_offset,0))
|
||||
img.paste(away_logo, (x_offset,0))
|
||||
|
||||
x_offset += home_logo.size[0] + 4
|
||||
x_offset += away_logo.size[0] + 4
|
||||
|
||||
score_image = self.textImage(intHomeScore + '-' + intAwayScore, large_font, h_buff = 5, r = 255, g = 255, b = 255)
|
||||
score_image = self.textImage(intAwayScore + '-' + intHomeScore, large_font, h_buff = 5, r = 255, g = 255, b = 255)
|
||||
|
||||
try:
|
||||
h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', ''))
|
||||
@ -2145,25 +2145,25 @@ class StockTicker():
|
||||
main_offset = x_offset + int(max(vs_size, date_timage.size[0], score_image.size[0])/2)
|
||||
img.paste(date_timage,(main_offset - int(date_timage.size[0]/2),0))
|
||||
img.paste(vs_timage, (main_offset - int(vs_timage.size[0]/2),10))
|
||||
img.paste(hc_timage, (main_offset - int(vs_timage.size[0]/2) - hc_timage.size[0], 9))
|
||||
img.paste(ac_timage, (main_offset - int(vs_timage.size[0]/2) - ac_timage.size[0], 9))
|
||||
img.paste(score_image, (main_offset - int(score_image.size[0]/2), 15))
|
||||
if match['isLive'] == 'post':
|
||||
if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
u_image = Image.new("RGB", (hc_timage.size[0] -2, 1))
|
||||
u_image1 = ImageDraw.Draw(u_image)
|
||||
u_image1.line((0,0,hc_timage.size[0]-2,0), fill="red", width = 0)
|
||||
img.paste(u_image, (main_offset - int(vs_timage.size[0]/2)-hc_timage.size[0], hc_timage.size[1]+7))
|
||||
img.paste(ac_timage, (main_offset + int(vs_timage.size[0]/2),9))
|
||||
if match['isLive'] == 'post':
|
||||
if int(intHomeScore) < int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
ua_image = Image.new("RGB", (ac_timage.size[0] -2, 1))
|
||||
ua_image = Image.new("RGB", (hc_timage.size[0] -2, 1))
|
||||
ua_image1 = ImageDraw.Draw(ua_image)
|
||||
ua_image1.line((0,0,ac_timage.size[0]-2,0), fill="red", width = 0)
|
||||
img.paste(ua_image, (main_offset + int(vs_timage.size[0]/2), ac_timage.size[1]+7))
|
||||
x_offset = (main_offset + max(int(date_timage.size[0]/2), int(vs_timage.size[0]/2) + ac_timage.size[0], int(score_image.size[0]/2)) + 4)
|
||||
ua_image1.line((0,0,hc_timage.size[0]-2,0), fill="red", width = 0)
|
||||
img.paste(ua_image, (main_offset - int(vs_timage.size[0]/2)-ac_timage.size[0], ac_timage.size[1]+7))
|
||||
img.paste(hc_timage, (main_offset + int(vs_timage.size[0]/2),9))
|
||||
if match['isLive'] == 'post':
|
||||
if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
u_image = Image.new("RGB", (ac_timage.size[0] -2, 1))
|
||||
u_image1 = ImageDraw.Draw(u_image)
|
||||
u_image1.line((0,0,ac_timage.size[0]-2,0), fill="red", width = 0)
|
||||
img.paste(u_image, (main_offset + int(vs_timage.size[0]/2), hc_timage.size[1]+7))
|
||||
x_offset = (main_offset + max(int(date_timage.size[0]/2), int(vs_timage.size[0]/2) + hc_timage.size[0], int(score_image.size[0]/2)) + 4)
|
||||
|
||||
img.paste(away_logo, (x_offset,0))
|
||||
x_offset += away_logo.size[0] + buff_size
|
||||
img.paste(home_logo, (x_offset,0))
|
||||
x_offset += home_logo.size[0] + buff_size
|
||||
|
||||
img = img.crop((0,0,x_offset,32))
|
||||
imgs.append(img)
|
||||
@ -2319,9 +2319,9 @@ class StockTicker():
|
||||
except Exception as e:
|
||||
away_logo = self.textImage(strAwayTeam.replace(' ', '\n'), extra_small_font, r = 255, g = 255, b = 255)
|
||||
|
||||
img.paste(home_logo, (x_offset,0))
|
||||
img.paste(away_logo, (x_offset,0))
|
||||
|
||||
x_offset += home_logo.size[0] + 4
|
||||
x_offset += away_logo.size[0] + 4
|
||||
|
||||
if time == 'future':
|
||||
#img.paste(date_timage, (x_offset+5, 0))
|
||||
@ -2350,11 +2350,11 @@ class StockTicker():
|
||||
|
||||
img.paste(date_timage, (main_offset - int(date_timage.size[0]/2), 0))
|
||||
img.paste(vs_timage, (main_offset - int(vs_timage.size[0]/2),9))
|
||||
img.paste(hc_timage, (main_offset - int(vs_timage.size[0]/2) - hc_timage.size[0], 9))
|
||||
img.paste(ac_timage, (main_offset + int(vs_timage.size[0]/2),9))
|
||||
x_offset = (main_offset + max(int(date_timage.size[0]/2), int(vs_timage.size[0]/2) + ac_timage.size[0]) + 6)
|
||||
img.paste(ac_timage, (main_offset - int(vs_timage.size[0]/2) - ac_timage.size[0], 9))
|
||||
img.paste(hc_timage, (main_offset + int(vs_timage.size[0]/2),9))
|
||||
x_offset = (main_offset + max(int(date_timage.size[0]/2), int(vs_timage.size[0]/2) + hc_timage.size[0]) + 6)
|
||||
else:
|
||||
score_image = self.textImage(intHomeScore + '-' + intAwayScore, large_font, h_buff = 5, r = 255, g = 255, b = 255)
|
||||
score_image = self.textImage(intAwayScore + '-' + intHomeScore, large_font, h_buff = 5, r = 255, g = 255, b = 255)
|
||||
try:
|
||||
h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', ''))
|
||||
except:
|
||||
@ -2379,29 +2379,32 @@ class StockTicker():
|
||||
main_offset = x_offset + int(max(vs_size, date_timage.size[0], score_image.size[0])/2)
|
||||
img.paste(date_timage,(main_offset - int(date_timage.size[0]/2),0))
|
||||
img.paste(vs_timage,(main_offset - int(vs_timage.size[0]/2),10))
|
||||
img.paste(hc_timage, (main_offset - int(vs_timage.size[0]/2) - hc_timage.size[0], 9))
|
||||
img.paste(ac_timage, (main_offset - int(vs_timage.size[0]/2) - ac_timage.size[0], 9))
|
||||
img.paste(score_image, (main_offset - int(score_image.size[0]/2), 15))
|
||||
if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
u_image = Image.new("RGB", (hc_timage.size[0] -2, 1))
|
||||
u_image1 = ImageDraw.Draw(u_image)
|
||||
u_image1.line((0,0,hc_timage.size[0]-2,0), fill="red", width = 0)
|
||||
img.paste(u_image, (main_offset - int(vs_timage.size[0]/2)-hc_timage.size[0], hc_timage.size[1]+7))
|
||||
img.paste(ac_timage, (main_offset + int(vs_timage.size[0]/2),9))
|
||||
if int(intHomeScore) < int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
ua_image = Image.new("RGB", (ac_timage.size[0] -2, 1))
|
||||
ua_image1 = ImageDraw.Draw(ua_image)
|
||||
ua_image1.line((0,0,ac_timage.size[0]-2,0), fill="red", width = 0)
|
||||
img.paste(ua_image, (main_offset + int(vs_timage.size[0]/2), ac_timage.size[1]+7))
|
||||
img.paste(ua_image, (main_offset - int(vs_timage.size[0]/2)-ac_timage.size[0], ac_timage.size[1]+7))
|
||||
img.paste(hc_timage, (main_offset + int(vs_timage.size[0]/2),9))
|
||||
if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
u_image = Image.new("RGB", (hc_timage.size[0] -2, 1))
|
||||
u_image1 = ImageDraw.Draw(u_image)
|
||||
u_image1.line((0,0,hc_timage.size[0]-2,0), fill="red", width = 0)
|
||||
img.paste(u_image, (main_offset + int(vs_timage.size[0]/2), hc_timage.size[1]+7))
|
||||
x_offset = (main_offset + max(int(date_timage.size[0]/2), int(vs_timage.size[0]/2) + hc_timage.size[0], int(score_image.size[0]/2)) + 4)
|
||||
|
||||
x_offset = (main_offset + max(int(date_timage.size[0]/2), int(vs_timage.size[0]/2) + ac_timage.size[0], int(score_image.size[0]/2)) + 4)
|
||||
img.paste(home_logo, (x_offset,0))
|
||||
|
||||
img.paste(away_logo, (x_offset,0))
|
||||
|
||||
x_offset += away_logo.size[0]
|
||||
x_offset += home_logo.size[0]
|
||||
x_offset += buff_size
|
||||
|
||||
img = img.crop((0,0,x_offset ,32))
|
||||
imgs.append(img)
|
||||
|
||||
|
||||
|
||||
|
||||
except Exception as e:
|
||||
pass
|
||||
# logf = open('log.txt', "a")
|
||||
@ -2741,10 +2744,10 @@ class StockTicker():
|
||||
|
||||
error = False
|
||||
|
||||
img.paste(home_logo1, (x_offset,0))
|
||||
x_offset += (home_logo1.size[0] + 2)
|
||||
img.paste(away_logo1, (x_offset,0))
|
||||
x_offset += (away_logo1.size[0] + 2)
|
||||
|
||||
score_image = self.textImage(intHomeScore + '-' + intAwayScore, font, h_buff = 5, r = 255, g = 255, b = 255)
|
||||
score_image = self.textImage(intAwayScore + '-' + intHomeScore, font, h_buff = 5, r = 255, g = 255, b = 255)
|
||||
|
||||
try:
|
||||
h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', ''))
|
||||
@ -2766,18 +2769,10 @@ class StockTicker():
|
||||
error = True
|
||||
|
||||
if date_timage.size[0] > (hc_timage.size[0] + 2 + score_image.size[0] + ac_timage.size[0]):
|
||||
x_offset10 = x_offset + int((date_timage.size[0]/2)-(score_image.size[0]/2)-hc_timage.size[0])
|
||||
x_offset10 = x_offset + int((date_timage.size[0]/2)-(score_image.size[0]/2)-ac_timage.size[0])
|
||||
img.paste(date_timage,(x_offset, 0))
|
||||
img.paste(score_image, (x_offset + int((date_timage.size[0]/2)-(score_image.size[0]/2)), 5))
|
||||
x_offset += date_timage.size[0]
|
||||
img.paste(hc_timage,(x_offset10, 5))
|
||||
if match['isLive'] == 'post':
|
||||
if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
u_image = Image.new("RGB", (hc_timage.size[0] -3, 1))
|
||||
u_image1 = ImageDraw.Draw(u_image)
|
||||
u_image1.line((0,0,hc_timage.size[0]-3,0), fill="red", width = 0)
|
||||
img.paste(u_image, (x_offset10, hc_timage.size[1]+4))
|
||||
x_offset10 += hc_timage.size[0] + score_image.size[0]
|
||||
img.paste(ac_timage,(x_offset10, 5))
|
||||
if match['isLive'] == 'post':
|
||||
if int(intHomeScore) < int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
@ -2785,32 +2780,29 @@ class StockTicker():
|
||||
ua_image1 = ImageDraw.Draw(ua_image)
|
||||
ua_image1.line((0,0,ac_timage.size[0]-3,0), fill="red", width = 0)
|
||||
img.paste(ua_image, (x_offset10, ac_timage.size[1]+4))
|
||||
x_offset10 += ac_timage.size[0]
|
||||
if error:
|
||||
img.paste(away_logo1, (max(x_offset + date_timage.size[0], x_offset10),0))
|
||||
x_offset += (away_logo1.size[0] + date_timage.size[0])
|
||||
else:
|
||||
img.paste(away_logo1, (max(x_offset,x_offset10),0))
|
||||
x_offset += away_logo1.size[0]
|
||||
|
||||
|
||||
else:
|
||||
x_offset_date = (x_offset + hc_timage.size[0] + int(score_image.size[0]/2) - int(date_timage.size[0]/2))
|
||||
img.paste(date_timage, (x_offset_date,0))
|
||||
#img.paste(date_timage, (x_offset+20+int((score_image.size[0] - date_timage.size[0])/2),0))
|
||||
img.paste(hc_timage, (x_offset, 5))
|
||||
|
||||
x_offset10 += ac_timage.size[0] + score_image.size[0]
|
||||
img.paste(hc_timage,(x_offset10, 5))
|
||||
if match['isLive'] == 'post':
|
||||
if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
u_image = Image.new("RGB", (hc_timage.size[0] -3, 1))
|
||||
u_image1 = ImageDraw.Draw(u_image)
|
||||
u_image1.line((0,0,hc_timage.size[0]-3,0), fill="red", width = 0)
|
||||
img.paste(u_image, (x_offset, hc_timage.size[1]+4))
|
||||
img.paste(u_image, (x_offset10, hc_timage.size[1]+4))
|
||||
x_offset10 += hc_timage.size[0]
|
||||
if error:
|
||||
img.paste(home_logo1, (max(x_offset + date_timage.size[0], x_offset10),0))
|
||||
x_offset += (home_logo1.size[0] + date_timage.size[0])
|
||||
else:
|
||||
img.paste(home_logo1, (max(x_offset,x_offset10),0))
|
||||
x_offset += home_logo1.size[0]
|
||||
|
||||
x_offset += hc_timage.size[0]
|
||||
img.paste(score_image, (x_offset, 5))
|
||||
x_offset += score_image.size[0]
|
||||
|
||||
else:
|
||||
x_offset_date = (x_offset + ac_timage.size[0] + int(score_image.size[0]/2) - int(date_timage.size[0]/2))
|
||||
img.paste(date_timage, (x_offset_date,0))
|
||||
#img.paste(date_timage, (x_offset+20+int((score_image.size[0] - date_timage.size[0])/2),0))
|
||||
img.paste(ac_timage, (x_offset, 5))
|
||||
|
||||
if match['isLive'] == 'post':
|
||||
if int(intHomeScore) < int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
ua_image = Image.new("RGB", (ac_timage.size[0] -3, 1))
|
||||
@ -2818,13 +2810,23 @@ class StockTicker():
|
||||
ua_image1.line((0,0,ac_timage.size[0]-3,0), fill="red", width = 0)
|
||||
img.paste(ua_image, (x_offset, ac_timage.size[1]+4))
|
||||
x_offset += ac_timage.size[0]
|
||||
img.paste(score_image, (x_offset, 5))
|
||||
x_offset += score_image.size[0]
|
||||
img.paste(hc_timage, (x_offset, 5))
|
||||
if match['isLive'] == 'post':
|
||||
if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
u_image = Image.new("RGB", (hc_timage.size[0] -3, 1))
|
||||
u_image1 = ImageDraw.Draw(u_image)
|
||||
u_image1.line((0,0,hc_timage.size[0]-3,0), fill="red", width = 0)
|
||||
img.paste(u_image, (x_offset, hc_timage.size[1]+4))
|
||||
x_offset += hc_timage.size[0]
|
||||
x_offset_date += date_timage.size[0]
|
||||
if error:
|
||||
img.paste(away_logo1, (max(x_offset + date_timage.size[0], x_offset_date),0))
|
||||
x_offset += (away_logo1.size[0] + date_timage.size[0])
|
||||
img.paste(home_logo1, (max(x_offset + date_timage.size[0], x_offset_date),0))
|
||||
x_offset += (home_logo1.size[0] + date_timage.size[0])
|
||||
else:
|
||||
img.paste(away_logo1, (max(x_offset,x_offset_date),0))
|
||||
x_offset += away_logo1.size[0]
|
||||
img.paste(home_logo1, (max(x_offset,x_offset_date),0))
|
||||
x_offset += home_logo1.size[0]
|
||||
x_offset += buff_size
|
||||
x_offset += 20
|
||||
img = img.crop((0,0,x_offset ,16))
|
||||
@ -2988,8 +2990,8 @@ class StockTicker():
|
||||
|
||||
error = False
|
||||
|
||||
img.paste(home_logo1, (x_offset,0))
|
||||
x_offset += (home_logo1.size[0] + 2)
|
||||
img.paste(away_logo1, (x_offset,0))
|
||||
x_offset += (away_logo1.size[0] + 2)
|
||||
|
||||
|
||||
if time == 'future':
|
||||
@ -3016,15 +3018,15 @@ class StockTicker():
|
||||
x_offsetdate2 = x_offset + int((hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0])/2)- int(date_timage.size[0]/2)
|
||||
img.paste(date_timage, (x_offsetdate2,0))
|
||||
x_offsetdate2 += date_timage.size[0]
|
||||
img.paste(hc_timage, (x_offset, 5))
|
||||
x_offset += hc_timage.size[0]
|
||||
img.paste(vs_timage, (x_offset, 5))
|
||||
x_offset += vs_timage.size[0]
|
||||
img.paste(ac_timage, (x_offset, 5))
|
||||
x_offset += ac_timage.size[0]
|
||||
img.paste(vs_timage, (x_offset, 5))
|
||||
x_offset += vs_timage.size[0]
|
||||
img.paste(hc_timage, (x_offset, 5))
|
||||
x_offset += hc_timage.size[0]
|
||||
#x_offset += max(date_timage.size[0], (hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0]))
|
||||
else:
|
||||
score_image = self.textImage(intHomeScore + '-' + intAwayScore, font, h_buff = 5, r = 255, g = 255, b = 255)
|
||||
score_image = self.textImage(intAwayScore + '-' + intHomeScore, font, h_buff = 5, r = 255, g = 255, b = 255)
|
||||
try:
|
||||
h_colour = mcolors.to_rgb(sports_info[strHomeTeam]['colour'].replace(' ', ''))
|
||||
except:
|
||||
@ -3045,19 +3047,10 @@ class StockTicker():
|
||||
ac_timage = self.textImage('.', small_font, r = 255, g = 255, b = 255)
|
||||
error = True
|
||||
|
||||
x_offsetdate2 = x_offset + hc_timage.size[0] + int(score_image.size[0]/2)- int(date_timage.size[0]/2)
|
||||
x_offsetdate2 = x_offset + ac_timage.size[0] + int(score_image.size[0]/2)- int(date_timage.size[0]/2)
|
||||
img.paste(date_timage, (x_offsetdate2,0))
|
||||
x_offsetdate2 += date_timage.size[0]
|
||||
#img.paste(date_timage, (x_offset+20+int((score_image.size[0] - date_timage.size[0])/2),0))
|
||||
img.paste(hc_timage, (x_offset, 5))
|
||||
if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
u_image = Image.new("RGB", (hc_timage.size[0] -3, 1))
|
||||
u_image1 = ImageDraw.Draw(u_image)
|
||||
u_image1.line((0,0,hc_timage.size[0]-3,0), fill="red", width = 0)
|
||||
img.paste(u_image, (x_offset, hc_timage.size[1]+4))
|
||||
x_offset += hc_timage.size[0]
|
||||
img.paste(score_image, (x_offset, 5))
|
||||
x_offset += score_image.size[0]
|
||||
img.paste(ac_timage, (x_offset, 5))
|
||||
if int(intHomeScore) < int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
ua_image = Image.new("RGB", (ac_timage.size[0] -3, 1))
|
||||
@ -3065,6 +3058,15 @@ class StockTicker():
|
||||
ua_image1.line((0,0,ac_timage.size[0]-3,0), fill="red", width = 0)
|
||||
img.paste(ua_image, (x_offset, ac_timage.size[1]+4))
|
||||
x_offset += ac_timage.size[0]
|
||||
img.paste(score_image, (x_offset, 5))
|
||||
x_offset += score_image.size[0]
|
||||
img.paste(hc_timage, (x_offset, 5))
|
||||
if int(intHomeScore) > int(intAwayScore) or int(intHomeScore) == int(intAwayScore):
|
||||
u_image = Image.new("RGB", (hc_timage.size[0] -3, 1))
|
||||
u_image1 = ImageDraw.Draw(u_image)
|
||||
u_image1.line((0,0,hc_timage.size[0]-3,0), fill="red", width = 0)
|
||||
img.paste(u_image, (x_offset, hc_timage.size[1]+4))
|
||||
x_offset += hc_timage.size[0]
|
||||
|
||||
# if date_timage.size[0] > score_image.size[0]:
|
||||
# img.paste(date_timage, (x_offset+2, 0))
|
||||
@ -3084,11 +3086,11 @@ class StockTicker():
|
||||
# x_offset += max( date_timage.size[0]+4, hc_timage.size[0] + vs_timage.size[0] + ac_timage.size[0]+4, 2 + int(score_image.size[0]))
|
||||
|
||||
if error:
|
||||
img.paste(away_logo1, (max(x_offset + date_timage.size[0], x_offsetdate2),0))
|
||||
x_offset += (away_logo1.size[0] + date_timage.size[0])
|
||||
img.paste(home_logo1, (max(x_offset + date_timage.size[0], x_offsetdate2),0))
|
||||
x_offset += (home_logo1.size[0] + date_timage.size[0])
|
||||
else:
|
||||
img.paste(away_logo1, (max(x_offset, x_offsetdate2),0))
|
||||
x_offset += away_logo1.size[0]
|
||||
img.paste(home_logo1, (max(x_offset, x_offsetdate2),0))
|
||||
x_offset += home_logo1.size[0]
|
||||
x_offset += buff_size
|
||||
x_offset += 20
|
||||
img = img.crop((0,0,x_offset ,16))
|
||||
|
Loading…
Reference in New Issue
Block a user