From 940e1e4008fd772b4757ed6d020f5405f13a535b Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 5 May 2023 15:21:53 +0800 Subject: [PATCH 01/37] pga and lpga logos for world ranking (team stats) --- logos/sports/league_logos/lpga_1.png | Bin 0 -> 1301 bytes logos/sports/league_logos/pga_1.png | Bin 0 -> 4735 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 logos/sports/league_logos/lpga_1.png create mode 100644 logos/sports/league_logos/pga_1.png diff --git a/logos/sports/league_logos/lpga_1.png b/logos/sports/league_logos/lpga_1.png new file mode 100644 index 0000000000000000000000000000000000000000..e73c753ab024576a13b9dd0a561334709ceb7188 GIT binary patch literal 1301 zcmV+w1?u{VP)Eh7e+05tV;o;%p(bChhv$T$nkYZzF85tSe-rw=@^8Eb# z@9Esx%&gYUx8vW}?CkC3<>s-ow6mC6xuR|1*S@{JztPgtkGG|CrH|n2=9|8+f2^3H zzOs|FroYh1gsYm)+0~|}smaR9wa>$0nSijzz1-s9b)t{U%+1f>*zfi7-|FSR*36ff zna$46kC2hIwzky7q145p-_y9yzLv?hiO#*1$+?xisCUxFtlHDU!mfhOz@n+Ds=1(M z=k@XE;@#9^WMuR7^jBC|^Y7@; z!J^E{vsjgUJA`K4-QMTm(4m4vw9C2;9tg0P()b5HFKSITHe#W+RnE6`}xq{+4=hV+~?!hfi0>+x7MH z{Qdoox27$9Tl4qz{r&xyysaH_Prpo%-0S4l=-|-q^YLt> zj8l_&MvHGrjBv}jmiYDX#ho_{b$*0SMrTF+WWHT~kGeLxImac+=uDn7dP**lXOb&Lt1alcU zbMo?GprEh_1_X*hQYED@P*z@1Syf#F0$?d#xKwRjeM4hY6I2QqRn7bmiI_Kwc3 z?#`Yjs1yTKs<*GSf5OB`{FA3loi@E@1~A}ZQhhT^`)19aGk0Ef&HM!mYZif}7W0D) zTT)uOv~A`z{$b2|eG%t1oqV?u2kOpxzv>XA_Dj+C?q=5lhD~bjHVHMvOUEIoP00000 LNkvXXu0mjfg@oxN literal 0 HcmV?d00001 diff --git a/logos/sports/league_logos/pga_1.png b/logos/sports/league_logos/pga_1.png new file mode 100644 index 0000000000000000000000000000000000000000..cae5efcba76d2cc6474c2df71126c69a6201dc2e GIT binary patch literal 4735 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 literal 0 HcmV?d00001 From 48ec140f3181bbb769f743ac893ae61b2f2a5257 Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 5 May 2023 15:44:04 +0800 Subject: [PATCH 02/37] lpga and pga pictures folders --- logos/lpga_rank/blank.rtf | 6 ++++++ logos/pga_rank/blank.rtf | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 logos/lpga_rank/blank.rtf create mode 100644 logos/pga_rank/blank.rtf diff --git a/logos/lpga_rank/blank.rtf b/logos/lpga_rank/blank.rtf new file mode 100644 index 0000000..15e538c --- /dev/null +++ b/logos/lpga_rank/blank.rtf @@ -0,0 +1,6 @@ +{\rtf1\ansi\ansicpg1252\cocoartf2513 +\cocoatextscaling0\cocoaplatform0{\fonttbl} +{\colortbl;\red255\green255\blue255;} +{\*\expandedcolortbl;;} +\margl1440\margr1440\vieww10800\viewh8400\viewkind0 +} \ No newline at end of file diff --git a/logos/pga_rank/blank.rtf b/logos/pga_rank/blank.rtf new file mode 100644 index 0000000..15e538c --- /dev/null +++ b/logos/pga_rank/blank.rtf @@ -0,0 +1,6 @@ +{\rtf1\ansi\ansicpg1252\cocoartf2513 +\cocoatextscaling0\cocoaplatform0{\fonttbl} +{\colortbl;\red255\green255\blue255;} +{\*\expandedcolortbl;;} +\margl1440\margr1440\vieww10800\viewh8400\viewkind0 +} \ No newline at end of file From 4fb8cc68ec4ac8a49bda3e3b75525ead35f5fc73 Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 5 May 2023 15:58:51 +0800 Subject: [PATCH 03/37] pga and lpga rankings added (team stats) --- database_caller.py | 67 +++++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 21 deletions(-) diff --git a/database_caller.py b/database_caller.py index 39178e2..fee35bd 100755 --- a/database_caller.py +++ b/database_caller.py @@ -791,30 +791,55 @@ def updateLeagueTables(api_key, logf): all_data = r.json() - - for i,l in enumerate(all_data): - league = list(l.keys())[0] - - teams = [] - - - for d in all_data[i][league]: - team = {} - - - - team['name'] = d['strTeam'] - team['wins'] = d['intWin'] - team['loss'] = d['intLoss'] - team['draw'] = d['intDraw'] - #team['played'] = d['intPlayed'] - team['standing'] = d['intRank'] - #team['points'] = d['intPoints'] - - teams.append(team) + if league == 'pga' or league == 'lpga': + logo_files = [] + for d in all_data[i][league]: + del d['_id'], d['updated'] + teams.append(d) + try: + if d['country'].split('/')[-1].split('&')[0] not in os.listdir('logos/ufc_countries/'): + urllib.request.urlretrieve(d['country'], 'logos/ufc_countries/' + d['country'].split('/')[-1].split('&')[0]) + except: + pass + try: + if league == 'pga': + if d['photo'].split('/')[-1].split('&')[0] not in os.listdir('logos/pga_rank/'): + urllib.request.urlretrieve(d['photo'],'logos/pga_rank/' + d['photo'].split('/')[-1].split('&')[0]) + elif league == 'lpga': + if d['photo'].split('/')[-1] not in os.listdir('logos/lpga_rank/'): + urllib.request.urlretrieve(d['photo'],'logos/lpga_rank/' + d['photo'].split('/')[-1]) + except: + pass + try: + if league == 'pga': + logo_files.append(d['photo'].split('/')[-1].split('&')[0]) + elif league == 'lpga': + logo_files.append(d['photo'].split('/')[-1]) + except: + pass + if league == 'pga': + for file in os.listdir('logos/pga_rank/'): + if file not in logo_files: + os.remove('logos/pga_rank/'+ file) + elif league == 'lpga': + for file in os.listdir('logos/lpga_rank/'): + if file not in logo_files: + os.remove('logos/lpga_rank/'+ file) + else: + for d in all_data[i][league]: + team = {} + team['name'] = d['strTeam'] + team['wins'] = d['intWin'] + team['loss'] = d['intLoss'] + team['draw'] = d['intDraw'] + #team['played'] = d['intPlayed'] + team['standing'] = d['intRank'] + #team['points'] = d['intPoints'] + teams.append(team) + leagues_info[league.upper()] = teams all_settings['leagues'] = leagues_info From bd630e922919419ea44ae9a9459165f1e8682ccf Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 5 May 2023 16:12:53 +0800 Subject: [PATCH 04/37] pga lpga added to web panel team stats --- templates/index.html | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/templates/index.html b/templates/index.html index 8809cee..44a6c18 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6181,17 +6181,10 @@
@@ -6220,14 +6213,10 @@ id="inputTransition10" - class="form-select animation-select" - - > + class="form-select animation-select"> - - @@ -6255,16 +6244,13 @@ From ea5fd4afb179491d062ae4de8db6ed9c7e0f842a Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 9 May 2023 16:18:55 +0800 Subject: [PATCH 05/37] lpga and pga world rankings --- stockTicker.py | 197 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 139 insertions(+), 58 deletions(-) diff --git a/stockTicker.py b/stockTicker.py index 2fe798f..7d935f1 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -3196,7 +3196,6 @@ class StockTicker(): all_settings = json.load(f) f.close() - leagues_info = all_settings['leagues'] leagues = list(leagues_info.keys()) @@ -3213,77 +3212,159 @@ class StockTicker(): x_offset = 0 img = Image.new('RGB', (10000, 32)) - - - league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') + + if league == 'PGA': + league_logo = Image.open('logos/sports/league_logos/pga_1.png').convert('RGB') + elif league == 'LPGA': + league_logo = Image.open('logos/sports/league_logos/lpga_1.png').convert('RGB') + else: + league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') img.paste(league_logo, (x_offset,0)) x_offset += league_logo.size[0] +self.blank.size[0] - - - + team_info = leagues_info[league] - + small_font = ImageFont.load("./fonts/5x7.pil") med_font = ImageFont.load("./fonts/8x13B.pil") large_font = ImageFont.load("./fonts/10x20.pil") - - + #if league =='NHL': # read the NHl info from the csv, prem will need this as well - sports_info = self.readSportsCSV(league) # gets colour and symbol info etc from csv - + try: + sports_info = self.readSportsCSV(league) # gets colour and symbol info etc from csv + except: + pass buff_size = 20 - + for team in team_info: - - try: - - - logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[team['name']]['logo'])) + if league == 'PGA' or league =='LPGA': + pga_font = ImageFont.load("./fonts/7x14.pil") + pga_small = ImageFont.load("./fonts/5x8.pil") + try: + if league == 'PGA': + player_img = Image.open('logos/pga_rank/' + team['photo'].split('/')[-1].split('&')[0]) + elif league == 'LPGA': + player_img = Image.open('logos/lpga_rank/' + team['photo'].split('/')[-1]) + player_img.thumbnail((9000,32)) + try: + img.paste(player_img, (x_offset, 0), mask=player_img) + except: + img.paste(player_img, (x_offset, 0)) + x_offset += player_img.size[0] + 2 + except: + pass + x_offset2 = x_offset + if league == 'LPGA': + if str(abs(team['rank_change'])) != '-' and str(abs(team['rank_change'])) != '0': + if int(team['rank_change']) > 0: + rank_change_img = self.textImage(str(abs(team['rank_change'])), pga_font, r = 0, g = 255, b = 0) + elif int(team['rank_change']) < 0: + rank_change_img = self.textImage(str(abs(team['rank_change'])), pga_font, r = 255, g = 0, b = 0) + elif league == 'PGA': + if str(team['rank_change']) != '-': + if int(team['rank_change']) > 0: + rank_change_img = self.textImage(str(abs(int(team['rank_change']))), pga_font, r = 0, g = 255, b = 0) + elif int(team['rank_change']) < 0: + rank_change_img = self.textImage(str(abs(int(team['rank_change']))), pga_font, r = 255, g = 0, b = 0) + + country_img = Image.open('logos/ufc_countries/' + team['country'].split('/')[-1].split('&')[0]) + country_img.thumbnail((9000,13)) + img.paste(country_img, (x_offset, 0)) + x_offset += country_img.size[0] + 2 + rank_img = self.textImage('#' + str(team['rank']), pga_font, r = 255, g=255, b=0) + img.paste(rank_img, (x_offset, 0)) + x_offset += rank_img.size[0] + 2 + name_img = self.textImage(team['first_name'].upper()[0] + '. ' + team['last_name'].upper(), pga_font, r= 255, g = 255, b = 255) + img.paste(name_img, (x_offset, 0)) + x_offset += name_img.size[0] + 5 + + if league == 'LPGA': + if str(abs(int(team['rank_change']))) != '-' and str(abs(int(team['rank_change']))) != '0': + try: + x_offset = x_offset - 3 + up_img = Image.open('logos/up-tiny.png') + down_img = Image.open('logos/down-tiny.png') + if int(team['rank_change']) > 0: + img.paste(up_img, (x_offset, 6)) + x_offset += up_img.size[0] + 2 + elif int(team['rank_change']) < 0: + img.paste(down_img, (x_offset, 6)) + x_offset += down_img.size[0] + 2 + img.paste(rank_change_img, (x_offset, 0)) + x_offset += rank_change_img.size[0] + 5 + except: + pass + elif league == 'PGA': + if str(team['rank_change']) != '-': + try: + x_offset = x_offset - 3 + up_img = Image.open('logos/up-tiny.png') + down_img = Image.open('logos/down-tiny.png') + if int(team['rank_change']) > 0: + img.paste(up_img, (x_offset, 6)) + x_offset += up_img.size[0] + 2 + elif int(team['rank_change']) < 0: + img.paste(down_img, (x_offset, 6)) + x_offset += down_img.size[0] + 2 + img.paste(rank_change_img, (x_offset, 0)) + x_offset += rank_change_img.size[0] + 5 + except: + pass + totalpts_img = self.textImage('Total:', pga_small, r = 255, g = 255, b = 255) + totalpts2_img = self.textImage(str(team['total_pts']), pga_small, r = 0, g = 255, b = 0) + img.paste(totalpts_img, (x_offset2, 14)) + img.paste(totalpts2_img, (x_offset2 + totalpts_img.size[0] + 2, 14)) + + avgpts_img = self.textImage('Avg:', pga_small, r = 255, g = 255, b = 255) + avgpts2_img = self.textImage(str(team['avg_pts']), pga_small, r = 0, g = 0, b = 255) + img.paste(avgpts_img, (x_offset2, 23)) + img.paste(avgpts2_img, (x_offset2 + 2 + avgpts_img.size[0], 23)) + events_img = self.textImage('Events:', pga_small, r= 255, g = 255, b = 255) + events2_img = self.textImage(str(team['events_played']), pga_small, r= 255, g = 128, b = 0) + img.paste(events_img, (x_offset2 + 10 + avgpts_img.size[0] + 2 + avgpts2_img.size[0], 23)) + img.paste(events2_img, (x_offset2 + 10 + avgpts_img.size[0] + 2 + avgpts2_img.size[0] + 2 + events_img.size[0], 23)) + try: + ptsgained_img = self.textImage('+'+str(team['gained_pts']), pga_small, r=0, g= 255, b=0) + ptslost_img = self.textImage(str(team['lost_pts']), pga_small, r=255, g= 0, b=0) + img.paste(ptsgained_img, (x_offset2 + totalpts_img.size[0] + 2 + totalpts2_img.size[0] + 5, 14)) + img.paste(ptslost_img, (x_offset2 + totalpts_img.size[0] + 2 + totalpts2_img.size[0] + 5 + ptsgained_img.size[0] + 3, 14)) + x_offset2 += max(avgpts_img.size[0] + 2 + avgpts2_img.size[0] + 10 + events_img.size[0] + 2 + events2_img.size[0], totalpts_img.size[0] + 2 + totalpts2_img.size[0] + 5 + ptsgained_img.size[0] + 3 + ptslost_img.size[0]) + except: + x_offset2 += max(avgpts_img.size[0] + 2 + avgpts2_img.size[0] + 10 + events_img.size[0] + 2 + events2_img.size[0], 2 + totalpts_img.size[0] + totalpts2_img.size[0]) + pass + + x_offset = max(x_offset, x_offset2) + 20 + + else: + try: + logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[team['name']]['logo'])) + img.paste(logo, (x_offset, 0)) + x_offset += logo.size[0] + 2 + except Exception as e: + pass + + name_timage = self.textImage(team['name'], med_font, r = 255, g = 255, b = 0) + wins_timage = self.textImage('Wins:' + str(team['wins']), small_font, r = 0, g = 255, b = 0) + loss_timage = self.textImage('Losses:' + str(team['loss']), small_font, r = 255, g = 0, b = 0) + draw_timage = self.textImage('Draws:' + str(team['draw']), small_font, r = 0, g = 0, b = 255) + standing_timage = self.textImage('Standing:' + str(team['standing']), small_font, r = 255, g = 255, b = 255) - - img.paste(logo, (x_offset, 0)) - x_offset += logo.size[0] + 2 - except Exception as e: - pass -# logf = open('log.txt', "a") -# exc_type, exc_obj, exc_tb = sys.exc_info() -# fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1] -# logf.write(str(e)) -# logf.write('. file: ' + fname) -# logf.write('. line: ' + str(exc_tb.tb_lineno)) -# logf.write('. type: ' + str(exc_type)) -# logf.write('\n ' + "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))) -# logf.close() + img.paste(name_timage, (x_offset, -1)) + img.paste(wins_timage, (x_offset, 12)) + img.paste(loss_timage, (x_offset, 19)) + img.paste(draw_timage, (x_offset, 26)) + x_offset += max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0]) + img.paste(standing_timage, (x_offset, 22)) - name_timage = self.textImage(team['name'], med_font, r = 255, g = 255, b = 0) - wins_timage = self.textImage('Wins:' + str(team['wins']), small_font, r = 0, g = 255, b = 0) - loss_timage = self.textImage('Losses:' + str(team['loss']), small_font, r = 255, g = 0, b = 0) - draw_timage = self.textImage('Draws:' + str(team['draw']), small_font, r = 0, g = 0, b = 255) - #points_timage = self.textImage('Points:' + team['points'], small_font, r = 255, g = 255, b = 255) - standing_timage = self.textImage('Standing:' + str(team['standing']), small_font, r = 255, g = 255, b = 255) - - - - img.paste(name_timage, (x_offset, -1)) - img.paste(wins_timage, (x_offset, 12)) - img.paste(loss_timage, (x_offset, 19)) - img.paste(draw_timage, (x_offset, 26)) - - x_offset += max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0]) - #img.paste(points_timage, (x_offset, 14)) - img.paste(standing_timage, (x_offset, 22)) - - - x_offset += standing_timage.size[0] - - if name_timage.size[0] > max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0]) + standing_timage.size[0]: - x_offset += name_timage.size[0] - (max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0]) + standing_timage.size[0]) - x_offset += buff_size - - + x_offset += standing_timage.size[0] + + if name_timage.size[0] > max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0]) + standing_timage.size[0]: + x_offset += name_timage.size[0] - (max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0]) + standing_timage.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") From a1015a617cdf023e69a4a3d5ac831b050a81695f Mon Sep 17 00:00:00 2001 From: Justin Date: Tue, 9 May 2023 17:47:17 +0800 Subject: [PATCH 06/37] lpga and pga world ranking prof --- stockTicker.py | 193 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 142 insertions(+), 51 deletions(-) diff --git a/stockTicker.py b/stockTicker.py index 7d935f1..4c8f358 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -3385,7 +3385,6 @@ class StockTicker(): all_settings = json.load(f) f.close() - leagues_info = all_settings['leagues'] leagues = list(leagues_info.keys()) @@ -3396,77 +3395,169 @@ class StockTicker(): else: imgs = [] - - for league in leagues: - + for league in leagues: try: x_offset = 0 img = Image.new('RGB', (10000, 32)) - - league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') + if league == 'PGA': + league_logo = Image.open('logos/sports/league_logos/pga_1.png').convert('RGB') + elif league == 'LPGA': + league_logo = Image.open('logos/sports/league_logos/lpga_1.png').convert('RGB') + else: + league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') width, height = league_logo.size league_logo2 = league_logo.resize((int(width/2), int(height/2))) img.paste(league_logo2, (x_offset,0)) x_offset += (league_logo2.size[0]+5) - team_info = leagues_info[league] font = ImageFont.load("./fonts/6x10.pil") - - - sports_info = self.readSportsCSV(league) + try: + sports_info = self.readSportsCSV(league) + except: + pass buff_size = 20 - for team in team_info: - - - name_timage = self.textImage(team['name'].upper(), font, r = 255, g = 255, b = 0) - wins_timage = self.textImage('W:' + str(team['wins']), font, r = 0, g = 255, b = 0) - loss_timage = self.textImage('L:' + str(team['loss']), font, r = 255, g = 0, b = 0) - draw_timage = self.textImage('D:' + str(team['draw']), font, r = 0, g = 0, b = 255) - standing_timage = self.textImage('#' + str(team['standing']), font, r = 255, g = 255, b = 255) - - - img.paste(standing_timage, (x_offset, 3)) - x_offset += (standing_timage.size[0]) + if league == 'PGA' or league =='LPGA': + pga_small = ImageFont.load("./fonts/4x6.pil") + try: + if league == 'PGA': + player_img = Image.open('logos/pga_rank/' + team['photo'].split('/')[-1].split('&')[0]) + elif league == 'LPGA': + player_img = Image.open('logos/lpga_rank/' + team['photo'].split('/')[-1]) + player_img.thumbnail((9000,16)) + try: + img.paste(player_img, (x_offset, 0), mask=player_img) + except: + img.paste(player_img, (x_offset, 0)) + x_offset += player_img.size[0] + 2 + except: + pass + if league == 'LPGA': + if str(abs(team['rank_change'])) != '-' and str(abs(team['rank_change'])) != '0': + if int(team['rank_change']) > 0: + rank_change_img = self.textImage(str(abs(team['rank_change'])), font, r = 0, g = 255, b = 0) + elif int(team['rank_change']) < 0: + rank_change_img = self.textImage(str(abs(team['rank_change'])), font, r = 255, g = 0, b = 0) + elif league == 'PGA': + if str(team['rank_change']) != '-': + if int(team['rank_change']) > 0: + rank_change_img = self.textImage(str(abs(int(team['rank_change']))), font, r = 0, g = 255, b = 0) + elif int(team['rank_change']) < 0: + rank_change_img = self.textImage(str(abs(int(team['rank_change']))), font, r = 255, g = 0, b = 0) + x_offset2 = x_offset + country_img = Image.open('logos/ufc_countries/' + team['country'].split('/')[-1].split('&')[0]) + country_img.thumbnail((9000,11)) + img.paste(country_img, (x_offset, -1)) - try: - - - logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[team['name']]['logo'])) - width, height = logo.size - logo2 = logo.resize((int(width/2), int(height/2))) - img.paste(logo2, (x_offset, 0)) - x_offset += (logo2.size[0] + 3) - except Exception as e: - pass + x_offset += country_img.size[0] + 2 + rank_img = self.textImage('#' + str(team['rank']), font, r = 255, g=255, b=0) + img.paste(rank_img, (x_offset, 0)) + x_offset += rank_img.size[0] + 2 + name_img = self.textImage(team['first_name'].upper()[0] + '. ' + team['last_name'].upper(), font, r= 255, g = 255, b = 255) + img.paste(name_img, (x_offset, 0)) + x_offset += name_img.size[0] + 2 + if league == 'LPGA': + if str(abs(int(team['rank_change']))) != '-' and str(abs(int(team['rank_change']))) != '0': + try: + up_img = Image.open('logos/up-tiny.png') + down_img = Image.open('logos/down-tiny.png') + if int(team['rank_change']) > 0: + img.paste(up_img, (x_offset, 3)) + x_offset += up_img.size[0] + 2 + elif int(team['rank_change']) < 0: + img.paste(down_img, (x_offset, 3)) + x_offset += down_img.size[0] + 2 + img.paste(rank_change_img, (x_offset, 0)) + x_offset += rank_change_img.size[0] + 2 + except: + pass + elif league == 'PGA': + if str(team['rank_change']) != '-': + try: + up_img = Image.open('logos/up-tiny.png') + down_img = Image.open('logos/down-tiny.png') + if int(team['rank_change']) > 0: + img.paste(up_img, (x_offset, 3)) + x_offset += up_img.size[0] + 2 + elif int(team['rank_change']) < 0: + img.paste(down_img, (x_offset, 3)) + x_offset += down_img.size[0] + 2 + img.paste(rank_change_img, (x_offset, 0)) + x_offset += rank_change_img.size[0] + 2 + except: + pass + + try: + ptsgained_img = self.textImage('+'+str(team['gained_pts']), pga_small, r=0, g= 255, b=0) + ptslost_img = self.textImage(str(team['lost_pts']), pga_small, r=255, g= 0, b=0) + img.paste(ptsgained_img, (x_offset, 3)) + x_offset += ptsgained_img.size[0] + 2 + img.paste(ptslost_img, (x_offset, 3)) + x_offset += ptslost_img.size[0] + 2 + except: + pass + + totalpts_img = self.textImage('Total:', pga_small, r = 255, g = 255, b = 255) + totalpts2_img = self.textImage(str(team['total_pts']), pga_small, r = 0, g = 255, b = 0) + img.paste(totalpts_img, (x_offset2, 10)) + x_offset2 += totalpts_img.size[0] + img.paste(totalpts2_img, (x_offset2, 10)) + x_offset2 += totalpts2_img.size[0] + 3 + + avgpts_img = self.textImage('Avg:', pga_small, r = 255, g = 255, b = 255) + avgpts2_img = self.textImage(str(team['avg_pts']), pga_small, r = 0, g = 0, b = 255) + img.paste(avgpts_img, (x_offset2, 10)) + x_offset2 += avgpts_img.size[0] + img.paste(avgpts2_img, (x_offset2, 10)) + x_offset2 += avgpts2_img.size[0] + 3 + + events_img = self.textImage('Events:', pga_small, r= 255, g = 255, b = 255) + events2_img = self.textImage(str(team['events_played']), pga_small, r= 255, g = 128, b = 0) + img.paste(events_img, (x_offset2, 10)) + x_offset2 += events_img.size[0] + img.paste(events2_img, (x_offset2, 10)) + x_offset2 += events2_img.size[0] + 3 + + x_offsetfinal = max(x_offset2, x_offset) + + x_offset = x_offsetfinal + 15 + + else: + name_timage = self.textImage(team['name'].upper(), font, r = 255, g = 255, b = 0) + wins_timage = self.textImage('W:' + str(team['wins']), font, r = 0, g = 255, b = 0) + loss_timage = self.textImage('L:' + str(team['loss']), font, r = 255, g = 0, b = 0) + draw_timage = self.textImage('D:' + str(team['draw']), font, r = 0, g = 0, b = 255) + standing_timage = self.textImage('#' + str(team['standing']), font, r = 255, g = 255, b = 255) + + img.paste(standing_timage, (x_offset, 3)) + x_offset += (standing_timage.size[0]) + + try: + logo = Image.open('logos/sports/{}/{}'.format(league, sports_info[team['name']]['logo'])) + width, height = logo.size + logo2 = logo.resize((int(width/2), int(height/2))) + img.paste(logo2, (x_offset, 0)) + x_offset += (logo2.size[0] + 3) + except Exception as e: + pass + + img.paste(name_timage, (x_offset, 3)) + x_offset += (name_timage.size[0] +2) + img.paste(wins_timage, (x_offset, 3)) + x_offset += (wins_timage.size[0] +2) + img.paste(loss_timage, (x_offset, 3)) + x_offset += (loss_timage.size[0] +2) + img.paste(draw_timage, (x_offset, 3)) + x_offset += (draw_timage.size[0]+10) - img.paste(name_timage, (x_offset, 3)) - x_offset += (name_timage.size[0] +2) - img.paste(wins_timage, (x_offset, 3)) - x_offset += (wins_timage.size[0] +2) - img.paste(loss_timage, (x_offset, 3)) - x_offset += (loss_timage.size[0] +2) - img.paste(draw_timage, (x_offset, 3)) - x_offset += (draw_timage.size[0]+10) - # x_offset += max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0]) - #img.paste(points_timage, (x_offset, 14)) - # img.paste(standing_timage, (x_offset, 22)) - - - # x_offset += standing_timage.size[0] - - # if name_timage.size[0] > max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0]) + standing_timage.size[0]: - # x_offset += name_timage.size[0] - (max( wins_timage.size[0], loss_timage.size[0], draw_timage.size[0]) + standing_timage.size[0]) - # x_offset += buff_size - x_offset += 25 img1 = img.crop((0,0,x_offset ,16)) imgs.append(img1) From f5387307587766fd28eff9b479b6d1d29789af5f Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 12 May 2023 16:20:52 +0800 Subject: [PATCH 07/37] display top 10 or 20 golfers --- stockTicker.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/stockTicker.py b/stockTicker.py index 4c8f358..beaa7d7 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -3205,7 +3205,7 @@ class StockTicker(): imgs = [title_img, self.blank] else: imgs = [] - + ten_or_twenty = slice(None) for league in leagues: try: @@ -3215,10 +3215,26 @@ class StockTicker(): if league == 'PGA': league_logo = Image.open('logos/sports/league_logos/pga_1.png').convert('RGB') + try: + if all_settings['top20'] == 10: + ten_or_twenty = slice(10) + else: + ten_or_twenty = slice(None) + except: + ten_or_twenty = slice(None) elif league == 'LPGA': league_logo = Image.open('logos/sports/league_logos/lpga_1.png').convert('RGB') + try: + if all_settings['top20'] == 10: + ten_or_twenty = slice(10) + else: + ten_or_twenty = slice(None) + except: + ten_or_twenty = slice(None) else: league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') + ten_or_twenty = slice(None) + img.paste(league_logo, (x_offset,0)) x_offset += league_logo.size[0] +self.blank.size[0] @@ -3235,7 +3251,7 @@ class StockTicker(): pass buff_size = 20 - for team in team_info: + for team in team_info[ten_or_twenty]: if league == 'PGA' or league =='LPGA': pga_font = ImageFont.load("./fonts/7x14.pil") pga_small = ImageFont.load("./fonts/5x8.pil") From 39ad5ee59a7bbe96ba7eebe07b40bbc22522c274 Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 12 May 2023 16:23:02 +0800 Subject: [PATCH 08/37] display top 10 or 20 golfer prof --- stockTicker.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/stockTicker.py b/stockTicker.py index beaa7d7..3cb74f8 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -3410,7 +3410,7 @@ class StockTicker(): imgs = [title_img, self.blank] else: imgs = [] - + ten_or_twenty = slice(None) for league in leagues: try: x_offset = 0 @@ -3419,10 +3419,25 @@ class StockTicker(): if league == 'PGA': league_logo = Image.open('logos/sports/league_logos/pga_1.png').convert('RGB') + try: + if all_settings['top20'] == 10: + ten_or_twenty = slice(10) + else: + ten_or_twenty = slice(None) + except: + ten_or_twenty = slice(None) elif league == 'LPGA': league_logo = Image.open('logos/sports/league_logos/lpga_1.png').convert('RGB') + try: + if all_settings['top20'] == 10: + ten_or_twenty = slice(10) + else: + ten_or_twenty = slice(None) + except: + ten_or_twenty = slice(None) else: league_logo = Image.open('logos/sports/league_logos/{}.png'.format(league)).convert('RGB') + ten_or_twenty = slice(None) width, height = league_logo.size league_logo2 = league_logo.resize((int(width/2), int(height/2))) img.paste(league_logo2, (x_offset,0)) @@ -3438,7 +3453,7 @@ class StockTicker(): buff_size = 20 - for team in team_info: + for team in team_info[ten_or_twenty]: if league == 'PGA' or league =='LPGA': pga_small = ImageFont.load("./fonts/4x6.pil") try: From 19b0202c9ef6137e721e1a9c2e31450bb0e0a147 Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 12 May 2023 16:56:57 +0800 Subject: [PATCH 09/37] top 20 or 10 golfers filter web panel --- templates/index.html | 70 +++++++++++++------------------------------- 1 file changed, 21 insertions(+), 49 deletions(-) diff --git a/templates/index.html b/templates/index.html index 44a6c18..0e3d169 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,69 +1,41 @@ - - - - - - - Fintic - Web Control Panel - - - - - - @@ -6228,21 +6200,14 @@
-
- -
- -
- -
+ +
+
+ +
+
+ +
+
+ +
+
- +
@@ -6294,14 +6272,8 @@ id="flexCheckChecked24" - {% - - if - - team_stats.title%} - + {% if team_stats.title%} checked - {%endif%} /> From 0b5c1a85b50e67df35aa6712521b23ddb83c4722 Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 12 May 2023 17:07:16 +0800 Subject: [PATCH 10/37] should be integer, not string value (top 10 20 golfer) --- templates/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/index.html b/templates/index.html index 0e3d169..f245b2b 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6236,8 +6236,8 @@
From 1239242f37fd1c9d4444f0c7543d962e799384be Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 12 May 2023 18:51:30 +0800 Subject: [PATCH 11/37] top20 golfers --- setup_config_files.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup_config_files.sh b/setup_config_files.sh index 1a527be..d4046d1 100755 --- a/setup_config_files.sh +++ b/setup_config_files.sh @@ -28,7 +28,7 @@ echo '{"feature": "Stocks", "speed": "medium","speed2": "medium", "animation": " echo '{"feature": "Stocks", "speed": "fast", "speed2": "fast", "animation": "down", "percent": true, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"BRENTOIL": {"current": "123.053", "unit": "bbl", "24hr_change": "1.0150", "percent_change": "0.83"}, "WTIOIL": {"current": "121.588", "unit": "bbl", "24hr_change": "0.8902", "percent_change": "0.74"}, "XAU": {"current": "1821.205", "unit": "oz", "24hr_change": "4.0045", "percent_change": "0.22"}, "XAG": {"current": "21.1034", "unit": "oz", "24hr_change": "-0.0550", "percent_change": "-0.26"}, "XCU": {"current": "0.2633", "unit": "oz", "24hr_change": "-0.0006", "percent_change": "-0.22"}, "NG": {"current": "8.6595", "unit": "mmbtu", "24hr_change": "-0.0236", "percent_change": "-0.27"}, "WHEAT": {"current": "393.123", "unit": "ton", "24hr_change": "-1.2642", "percent_change": "-0.32"}, "COTTON": {"current": "1.4494", "unit": "lb", "24hr_change": "0.0004", "percent_change": "0.03"}, "RICE": {"current": "16.3849", "unit": "cwt", "24hr_change": "0.0093", "percent_change": "0.06"}, "SUGAR": {"current": "0.1866", "unit": "lb", "24hr_change": "-0.0007", "percent_change": "-0.40"}, "COCOA": {"current": "2374.074", "unit": "ton", "24hr_change": "2.5206", "percent_change": "0.11"}, "LUMBER": {"current": "527.842", "unit": "oz", "24hr_change": "0.2641", "percent_change": "0.05"}, "SOYBEAN": {"current": "17.1621", "unit": "bu", "24hr_change": "0.0270", "percent_change": "0.16"}}}' >> commodities_settings.json echo '{"feature": "Stocks", "speed": "fast", "speed2": "slow", "animation": "up", "percent": true, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"^HSI": {"name": "HSI", "current": "18083.06", "point_change": "1003.55", "percent_change": "5.88"}, "^GSPC": {"name": "S&P 500", "current": "3790.93", "point_change": "112.50", "percent_change": "3.06"}, "^RUT": {"name": "RUSSELL 2000", "current": "1775.77", "point_change": "66.90", "percent_change": "3.91"}, "^GDAXI": {"name": "DAX", "current": "12648.95", "point_change": "-21.53", "percent_change": "-0.17"}, "^FTSE": {"name": "FTSE 100", "current": "7058.68", "point_change": "-27.82", "percent_change": "-0.39"}, "^FCHI": {"name": "CAC 40", "current": "6031.45", "point_change": "-8.24", "percent_change": "-0.14"}, "399001.SZ": {"name": "SZSE", "current": "10778.61", "point_change": "-140.83", "percent_change": "-1.29"}, "^STOXX50E": {"name": "STOXX 50", "current": "3476.55", "point_change": "-7.93", "percent_change": "-0.23"}, "^AXJO": {"name": "ASX 200", "current": "6815.70", "point_change": "116.40", "percent_change": "1.74"}, "^DJI": {"name": "DOW JONES", "current": "30316.32", "point_change": "825.43", "percent_change": "2.80"}, "^STOXX": {"name": "STOXX 600", "current": "402.33", "point_change": "-0.70", "percent_change": "-0.17"}}}' >> indices_settings.json -echo '{"feature": "Sports (Team Stats)", "speed": "medium", "speed2": "medium","animation": "down", "title": true, "leagues": {}}' >> league_tables.json +echo '{"feature": "Sports (Team Stats)", "speed": "medium", "speed2": "medium","animation": "down", "title": true, "top20": 20, "leagues": {}}' >> league_tables.json echo {\"feature\": \"Current Weather\", \"speed\": \"medium\", \"animation\": \"down\", \"temp\": \"celsius\", \"wind_speed\": \"miles/sec\", \"colour\": \"white\", \"city_colour\": \"yellow\", \"title\": true, \"locations\": {}, \"current_weather\": true} >> current_weather.json echo '{"feature": "Stocks", "speed": "medium", "speed2": "medium", "animation": "down", "percent": false, "point": true, "logos": true, "chart": false, "title": true, "symbols": {"AAPL": {"current": "164.02", "change": "-1.59", "percent_change": "-0.97"}, "MSFT": {"current": "288.29", "change": "-1.32", "percent_change": "-0.46"}, "GOOG": {"current": "2586.74", "change": "-34.01", "percent_change": "-1.31"}, "NFLX": {"current": "380.52", "change": "-7.59", "percent_change": "-1.99"}}, "prepost": false}' >> stocks_settings.json echo {\"feature\": \"Current Weather\", \"speed\": \"medium\", \"animation\": \"down\", \"temp\": \"celsius\", \"wind_speed\": \"miles/sec\", \"colour\": \"white\", \"city_colour\": \"yellow\", \"title\": true, \"locations\": {}, \"current_weather\": true} >> daily_weather.json From 5902a8ba5f64a3208ab593760385d6d2214d9393 Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 15 May 2023 13:10:09 +0800 Subject: [PATCH 12/37] change arrangement of top 20 and 10 --- templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index f245b2b..0fc29bf 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6236,8 +6236,8 @@
From f7ef1051251b7072952129c6faa1da70ab7901cb Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 15 May 2023 16:04:50 +0800 Subject: [PATCH 13/37] setTop20 onclick function --- templates/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/index.html b/templates/index.html index 0fc29bf..b2ead18 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6241,7 +6241,7 @@
-
From 4eae72d1e7bbc714aebaf7139182b9bcca9f5fcd Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 15 May 2023 16:27:01 +0800 Subject: [PATCH 14/37] add top 10 or 20 server.py fetch --- static/app.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/static/app.js b/static/app.js index 86a35d2..b61f3c3 100755 --- a/static/app.js +++ b/static/app.js @@ -2695,3 +2695,13 @@ function saveSchedulerSettings() { document.getElementById('saved').style.display = "block"; } + +// CHANGE TOP 20 OR TOP 10 WORLD GOLF RANKING +function setTop20() { + let top20 = document.getElementById("golf-ranking-number").value; + fetch("/setTop20or10", { + method: "POST", + body: JSON.stringify(top20), + }); +} + From 0fdf4e2efc52878bb11856712443378aa3f61b39 Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 15 May 2023 16:27:49 +0800 Subject: [PATCH 15/37] change top 10 or 20 golfers --- server.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/server.py b/server.py index dc089a5..0f8c1d3 100755 --- a/server.py +++ b/server.py @@ -1334,6 +1334,29 @@ def saveSchedulerSettings(): return index() +@app.route("/setTop20or10", methods = ['PUT', 'POST']) +def setTop20or10(): + + data= request.data.decode('utf-8') + input_settings = json.loads(data) + + with open('csv/league_tables.json','r') as f: + league_settings = json.load(f) + + if input_settings == 'Top 20': + input_settings = 20 + elif input_settings == 'Top 10': + input_settings = 10 + else: + input_settings = 20 + + league_settings['top20'] = input_settings + + f = open('csv/league_tables.json', 'w') + json.dump(league_settings, f) + f.close() + + return index() if __name__ == "__main__": From e167f234e15a2bd0546c3756a7a13c75abf0fa2c Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 15 May 2023 16:30:57 +0800 Subject: [PATCH 16/37] change to 1.3.5 version --- templates/index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/index.html b/templates/index.html index b2ead18..56f5807 100644 --- a/templates/index.html +++ b/templates/index.html @@ -39,7 +39,7 @@ - + @@ -99,7 +99,7 @@
-

Version 1.3.4

+

Version 1.3.5

Changelog

@@ -8503,7 +8503,7 @@ - +