-
Notifications
You must be signed in to change notification settings - Fork 0
/
model.py
513 lines (439 loc) · 23 KB
/
model.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
# coding=utf8
import os
import sys
import copy
import paramiko
import logging
from PIL import Image, ImageFont, ImageDraw, ImageFilter
from paramiko.ssh_exception import AuthenticationException, SSHException
logging.basicConfig(level=os.environ.get("LOGLEVEL", "INFO"))
log = logging.getLogger("paramiko_logger")
class Team:
"""Klasa reprezentujaca linijke statystyczna druzyny"""
def __init__(self, fgm, fga,fgm3,fga3,ftm,fta,tp,blk,stl,ast,min,oreb,dreb,treb,pf,tf,to,dq,fgpct,fg3pct,ftpct,teamname,vh, large_lead, lead_time, leads, ties, pts_bench, pts_fastb, pts_paint, pts_ch2, pts_to, short_teamname):
self.fgm2 = int(fgm) - int(fgm3)
self.fga2 = int(fga) - int(fga3)
self.fg2_percent = f"{round(self.fgm2/self.fga2 * 100, 1)}" if self.fga2 != 0 else "0.0"
self.fgm3 = int(fgm3)
self.fga3 = int(fga3)
self.fg3_percent = f"{round(self.fgm3/self.fga3 * 100, 1)}" if self.fga3 != 0 else "0.0"
self.fgm = int(fgm)
self.fga = int(fga)
self.fg_percent = f"{round(self.fgm/self.fga * 100, 1)}" if self.fga != 0 else "0.0"
self.ftm = int(ftm)
self.fta = int(fta)
self.ft_percent = f"{round(self.ftm/self.fta * 100, 1)}" if self.fta != 0 else "0.0"
self.points = int(tp)
self.blocks = int(blk)
self.steals = int(stl)
self.assists = int(ast)
self.minutes = int(min)
self.offensive_rebounds = int(oreb)
self.defensive_rebounds = int(dreb)
self.rebounds = self.defensive_rebounds + self.offensive_rebounds
self.fouls = int(pf)
self.tf = int(tf)
self.turnovers = int(to)
self.disq = int(dq)
self.teamname = teamname
self.large_lead = int(large_lead)
self.pts_bench = int(pts_bench)
self.pts_fastb = int(pts_fastb)
self.pts_paint = int(pts_paint)
self.pts_ch2 = int(pts_ch2)
self.pts_to = int(pts_to)
self.players = []
self.id = short_teamname
def __repr__(self):
return f'\nPoints - {self.points}, Team - {self.teamname}, Players - {self.players}'
def set_team_stats(self, oreb, dreb, treb, pf, tf, to, dq, code):
self.team_oreb = oreb
self.team_dreb = dreb
self.team_treb = treb
self.team_to = to
def set_timeouts_in_current_half(self, root):
self.timeouts = get_timeouts_from_current_half(root, self.id)
def __eq__(self, other):
if not isinstance(other, Team):
return False
return self.teamname == other.teamname
class Player:
"""Klasa reprezentujaca linijke statystyczna zawodnika"""
def __init__(self, name, surname, code, fgm=0, fga=0,fgm3=0,fga3=0,ftm=0,fta=0,tp=0,blk=0,stl=0,ast=0,min=0,oreb=0,dreb=0,treb=0,pf=0,tf=0,to=0,dq=0,fgpct=0,fg3pct=0,ftpct=0,gp=0,gs=0,teamname=0,oncourt=0,sec=0,short_teamname=''):
self.name = name
self.surname = surname
self.number = code
self.length_of_prefix = len(f"{name}{surname}{code}")
# self.prefix = (f" {code}" if len(str(code))==1 else f"{code}") + f" {name} {surname}"
self.fullname = f"{name} {surname}"
self.fgm2 = int(fgm) - int(fgm3)
self.fga2 = int(fga) - int(fga3)
self.fg2_percent = f"{round(self.fgm2/self.fga2 * 100, 1)}" if self.fga2 != 0 else "0.0"
self.fgm3 = int(fgm3)
self.fga3 = int(fga3)
self.fg3_percent = f"{round(self.fgm3/self.fga3 * 100, 1)}" if self.fga3 != 0 else "0.0"
self.fgm = int(fgm)
self.fga = int(fga)
self.fg_percent = f"{round(self.fgm/self.fga * 100, 1)}" if self.fga != 0 else "0.0"
self.ftm = int(ftm)
self.fta = int(fta)
self.ft_percent = f"{round(self.ftm/self.fta * 100, 1)}" if self.fta != 0 else "0.0"
self.points = int(tp)
self.blocks = int(blk)
self.steals = int(stl)
self.assists = int(ast)
self.minutes = int(min)
self.offensive_rebounds = int(oreb)
self.defensive_rebounds = int(dreb)
self.rebounds = self.offensive_rebounds + self.defensive_rebounds
self.fouls = int(pf)
self.tf = int(tf)
self.turnovers = int(to)
self.disq = int(dq)
self.gp=gp
self.gs=gs
self.teamname = teamname
self.short_teamname = short_teamname
self.eval = self.points + self.rebounds + self.steals + self.blocks + self.assists - self.turnovers - (self.fga - self.fgm) - (self.fta - self.ftm)
self.oncourt = oncourt
def __repr__(self):
return f'{self.name}, {self.surname}, {self.number}, {self.teamname}, {self.oncourt}'
def __eq__(self, other):
if not isinstance(other, Player):
return False
return self.name == other.name and self.surname == other.surname and self.teamname == other.teamname and self.number == other.number
class RemoteXML():
def __init__(self, server_ip, username, private_key_path, server_path_to_xml, password):
self.server_ip = server_ip
self.username = username
self.private_key_path = private_key_path
self.server_path_to_xml = server_path_to_xml
self.password = password
def init_ssh_session(self):
self.ssh = paramiko.SSHClient()
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
k = paramiko.RSAKey.from_private_key_file(filename=self.private_key_path)
self.ssh.connect(hostname=self.server_ip, username=self.username, pkey=k)
except (AuthenticationException, FileNotFoundError, SSHException):
log.warning("Plik z kluczem nie znaleziony bądź nieprawidłowy, próba logowania przez hasło")
try:
self.ssh.connect(hostname=self.server_ip, username=self.username, password=self.password)
log.info("Udało się zalogować za pomocą hasła")
except AuthenticationException:
log.error("Hasło z 'config.json' jest nieprawidłowe!")
return False
self.sftp = self.ssh.open_sftp()
return True
def download_xml_from_server(self, local_save_path):
self.sftp.get(self.server_path_to_xml, local_save_path)
def close_ssh_session(self):
self.sftp.close()
self.ssh.close()
def make_player_statistic_line(player_stat, player_detail, team):
if(player_stat is not None):
player_info = get_dict_from_list_of_tuples(player_stat.items())
else:
player_info = dict()
for key, value in player_detail.items():
if(key=='name'):
if(value=='TEAM'):
team.set_team_stats(**player_info)
return None
data = str(value).replace(' ', '')
data = data.split(",")
player_info['name']=data[1]
player_info['surname']=data[0]
if(key=='gp' or key == 'gs' or key == 'code'):
player_info[key]=value
if(key=='oncourt'):
if(value=="Y"):
player_info[key]=True
elif(value=="N"):
player_info[key]=False
player_info['teamname'] = team.teamname
player_info['short_teamname'] = team.id
return Player(**player_info)
def make_team_statistic_line(team_stat, special_stat, team_detail):
info = get_dict_from_list_of_tuples(team_stat.items())
info.update(get_dict_from_list_of_tuples(special_stat.items()))
info['teamname'] = get_value_from_list_of_tuples_by_key(team_detail.items(), 'name')
info['short_teamname'] = get_value_from_list_of_tuples_by_key(team_detail.items(), 'id')
return Team(**info)
def get_value_from_list_of_tuples_by_key(tuples_list, key_to_find):
for key, value in tuples_list:
if(key==key_to_find):
return value
def get_dict_from_list_of_tuples(tuples_list):
info = dict()
for key, value in tuples_list:
info[key]=value
return info
def get_fouls_from_period(root, period):
if(period < 1):
return
fouls = {}
for counter, totals in enumerate(root.findall(f"./team/totals")):
for statsbyprd in totals.findall(f"statsbyprd"):
if(str(period) == statsbyprd.get('prd')):
foul_amount = int(statsbyprd.get('pf'))
if(foul_amount > 5):
foul_amount = 5
fouls[f"druzyna_{counter}"] = foul_amount
return fouls
def get_timeouts_from_current_quarter(root):
period = get_value_from_list_of_tuples_by_key(root.find('status').items(), 'period')
def check_if_files_exist(files):
for file_to_check in files:
if(not os.path.exists(file_to_check)):
return False
return True
def check_if_file_exists(file_to_check):
if(os.path.exists(file_to_check)):
return True
else:
return False
def get_fouls(root):
period = int(root.find('status').get('period'))
fouls = get_fouls_from_period(root, period)
if(not fouls):
fouls = get_fouls_from_period(root, period - 1)
if(not fouls):
fouls = dict()
fouls[f"druzyna_0"] = 0
fouls[f"druzyna_1"] = 0
return fouls
def get_officials(root):
officials_string = ""
officials_single = root.find('venue/officials').get('text').split(', ')
for official_single in officials_single:
officials_string += f"{official_single}\n"
return officials_string
def get_date(root):
return f"{root.find('venue').get('date')} {root.find('venue').get('start')}"
def get_teams_from_xml(root):
players,teams = [],[]
for team_xml in root.findall("./team"):
team = make_team_statistic_line(team_xml.find("./totals/stats"),team_xml.find("./totals/special"), team_xml)
for player_info in team_xml.findall("player"):
player = make_player_statistic_line(player_info.find('stats'), player_info, team)
if(player is not None):
players.append(player)
team.players = copy.deepcopy(players)
team.set_timeouts_in_current_half(root)
players = []
teams.append(team)
return teams
def get_timeouts_from_current_half(root, team_shortname):
timeouts = 0
period = get_value_from_list_of_tuples_by_key(root.find('status').items(), 'period')
if(int(period) < 3):
periods = ['1', '2']
else:
periods = ['3', '4', '5', '6', '7']
for quarter_plays in root.findall(f"./plays/period"):
if(get_value_from_list_of_tuples_by_key(quarter_plays.items(), 'number') in periods):
for play in quarter_plays.findall('play'):
if(get_value_from_list_of_tuples_by_key(play.items(), 'action') == "TIMEOUT"):
if(get_value_from_list_of_tuples_by_key(play.items(), 'team') == team_shortname):
timeouts += 1
return timeouts
def get_points_stat(prefix, value, object_with_stats):
return f"{prefix} - {object_with_stats.points} {get_polish_plural('punkt', 'punkty', 'punktów', object_with_stats.points)}, {object_with_stats.fgm3}/{object_with_stats.fga3} za 3, {object_with_stats.fgm2}/{object_with_stats.fga2} za 2, {object_with_stats.ftm}/{object_with_stats.fta} za 1"
def get_fga2_stat(prefix, value, object_with_stats):
if(isinstance(object_with_stats, Player)):
return f"{prefix} - {object_with_stats.points} {get_polish_plural('punkt', 'punkty', 'punktów', object_with_stats.points)}, {object_with_stats.fgm2}/{object_with_stats.fga2} za 2"
else:
return f"{prefix} - {object_with_stats.fgm2}/{object_with_stats.fga2} za 2"
def get_fga3_stat(prefix, value, object_with_stats):
if(isinstance(object_with_stats, Player)):
return f"{prefix} - {object_with_stats.points} {get_polish_plural('punkt', 'punkty', 'punktów', object_with_stats.points)}, {object_with_stats.fgm3}/{object_with_stats.fga3} za 3"
else:
return f"{prefix} - {object_with_stats.fgm3}/{object_with_stats.fga3} za 3"
def get_fta_stat(prefix, value, object_with_stats):
if(isinstance(object_with_stats, Player)):
return f"{prefix} - {object_with_stats.points} {get_polish_plural('punkt', 'punkty', 'punktów', object_with_stats.points)}, {object_with_stats.ftm}/{object_with_stats.fta} za 1"
else:
return f"{prefix} - {object_with_stats.ftm}/{object_with_stats.fta} za 1"
def get_blocks_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('blok', 'bloki', 'bloków', value)}"
def get_pts_fastb_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('punkt', 'punkty', 'punktów', value)} z kontry"
def get_pts_bench_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('punkt', 'punkty', 'punktów', value)} ławki"
def get_pts_paint_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('punkt', 'punkty', 'punktów', value)} z pomalowanego"
def get_pts_ch2_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('punkt', 'punkty', 'punktów', value)} drugiej szansy"
def get_steals_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('przechwyt', 'przechwyty', 'przechwytów', value)}"
def get_assists_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('asysta', 'asysty', 'asyst', value)}"
def get_offensive_rebounds_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('zbiórka', 'zbiórki', 'zbiórek', value)} w ataku"
def get_defensive_rebounds_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('zbiórka', 'zbiórki', 'zbiórek', value)} w obronie"
def get_rebounds_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('zbiórka', 'zbiórki', 'zbiórek', value)}"
def get_fouls_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('faul', 'faule', 'fauli', value)}"
def get_turnovers_stat(prefix, value, object_with_stats):
return f"{prefix} - {value} {get_polish_plural('strata', 'straty', 'strat', value)}"
def get_polish_plural(singularNominativ, pluralNominativ, pluralGenitive, value):
if (value == 1):
return singularNominativ
elif (value % 10 >= 2 and value % 10 <= 4 and (value % 100 < 10 or value % 100 >= 20)):
return pluralNominativ
else:
return pluralGenitive
def get_fg_percent_string(percent):
if(len(percent)==3):
return f" {percent}"
elif(len(percent)==4):
return f" {percent}"
elif(len(percent)==5):
return percent
def get_fg_string(attempts, made, percent):
space_shift = ' '
string = ''
if(attempts != 0):
if(len(str(made))==1):
player_fgm2 = f" {made}"
else:
player_fgm2 = made
if(len(str(attempts))==1):
player_fga2 = f"{attempts} "
else:
player_fga2 = attempts
string += f"{space_shift}{player_fgm2}/{player_fga2}"
string += f"{space_shift}{get_fg_percent_string(percent)}%"
else:
string += f"{space_shift} {space_shift} 0.0%"
return string
def get_value_on_3_position(value):
if(len(value)==1):
return f" {value} "
elif(len(value)==2):
return f"{value} "
elif(len(value)==3):
return f"{value}"
def get_object_with_stat_stats_string(object_with_stat):
string = ''
space_shift = ' '
string += get_value_on_3_position(str(object_with_stat.points))
string += get_fg_string(object_with_stat.fga2, object_with_stat.fgm2, object_with_stat.fg2_percent)
string += get_fg_string(object_with_stat.fga3, object_with_stat.fgm3, object_with_stat.fg3_percent)
string += get_fg_string(object_with_stat.fta, object_with_stat.ftm, object_with_stat.ft_percent)
for value in [object_with_stat.offensive_rebounds, object_with_stat.defensive_rebounds, object_with_stat.rebounds, object_with_stat.assists, object_with_stat.fouls, object_with_stat.turnovers, object_with_stat.steals, object_with_stat.blocks]:
string += get_value_if_not_equals_to_zero(value)
if(isinstance(object_with_stat, Player)):
string += f"{space_shift}{object_with_stat.eval}"
return string
def get_team_stats_string(team):
return ' ' * 54 + f"{get_value_if_not_equals_to_zero(team.team_oreb)}{get_value_if_not_equals_to_zero(team.team_dreb)}{get_value_if_not_equals_to_zero(team.team_treb)}" + ' ' * 12 + get_value_with_tab_if_not_equals_to_zero(team.team_to)
def get_players_stats_string_to_txt(team):
string = ''
max_prefix_length = max(player.length_of_prefix for player in team.players)
for player in team.players:
string += f"\n{player.number} {player.name} {player.surname}" + " " * (max_prefix_length - player.length_of_prefix)
string += f"\t{player.points}\t{player.minutes}"
string += get_object_with_stat_string(player)
string += f"\t{player.eval}"
string += f"\nDrużynowe\t\t\t\t\t\t\t\t\t\t\t{get_value_with_tab_if_not_equals_to_zero(team.team_oreb)}{get_value_with_tab_if_not_equals_to_zero(team.team_dreb)}{get_value_with_tab_if_not_equals_to_zero(team.team_treb)}\t\t\t{get_value_with_tab_if_not_equals_to_zero(team.team_to)}"
string += "\nSuma\t"
return string
def get_object_with_stat_string(object_with_stat):
string = ''
if(object_with_stat.fga2 != 0):
string += f"\t{object_with_stat.fgm2}/{object_with_stat.fga2}"
string += f"\t{object_with_stat.fg2_percent}%"
else:
string += f"\t\t0.0%"
if(object_with_stat.fga3 != 0):
string += f"\t{object_with_stat.fgm3}/{object_with_stat.fga3}"
string += f"\t{object_with_stat.fg3_percent}%"
else:
string += f"\t\t0.0%"
if(object_with_stat.fga != 0):
string += f"\t{object_with_stat.fgm}/{object_with_stat.fga}"
string += f"\t{object_with_stat.fg_percent}%"
else:
string += f"\t\t0.0%"
if(object_with_stat.fta !=0):
string += f"\t{object_with_stat.ftm}/{object_with_stat.fta}"
string += f"\t{object_with_stat.ft_percent}%"
else:
string += f"\t\t0.0%"
string += get_value_with_tab_if_not_equals_to_zero(object_with_stat.offensive_rebounds)
string += get_value_with_tab_if_not_equals_to_zero(object_with_stat.defensive_rebounds)
string += get_value_with_tab_if_not_equals_to_zero(object_with_stat.rebounds)
string += get_value_with_tab_if_not_equals_to_zero(object_with_stat.assists)
string += get_value_with_tab_if_not_equals_to_zero(object_with_stat.fouls)
string += get_value_with_tab_if_not_equals_to_zero(object_with_stat.turnovers)
string += get_value_with_tab_if_not_equals_to_zero(object_with_stat.steals)
string += get_value_with_tab_if_not_equals_to_zero(object_with_stat.blocks)
return string
def get_value_if_not_equals_to_zero(value):
space_shift = ' '
if(value != 0):
return f"{space_shift}{value}" + ' ' * (2 - len(str(value)))
else:
return f"{space_shift} "
def get_value_with_tab_if_not_equals_to_zero(value):
if(value != 0):
return f"\t{value}"
else:
return f"\t"
class GraphicEditor():
def __init___(self):
pass
def edit_photo(self, team_counter, resources_path, team, filename_to_save, fontname):
my_image = Image.open(f"{resources_path}\\templates\\player_stats.png")
font_fullname = ImageFont.truetype(f"{resources_path}\\fonts\\{fontname}.ttf", 24)
font_stats_bold = ImageFont.truetype(f"{resources_path}\\fonts\\{fontname}.ttf", 22)
team_font = ImageFont.truetype(f"{resources_path}\\fonts\\{fontname}.ttf", 80)
image_editable = ImageDraw.Draw(my_image)
try:
team_logo = Image.open(f"{resources_path}\\photos\\druzyna_{team_counter}_logo.png")
team_logo.thumbnail((337,337), Image.ANTIALIAS)
my_image.paste(team_logo)
except FileNotFoundError:
print(f"Wątek ze skanowaniem statystyk nie mógł odnaleźć loga drużyny {team.teamname}, powinno znajdować się w katalogu 'resources\\photos\' w pliku 'druzyna_{team_counter}_logo.png'")
image_editable.text((400, 120), team.teamname, (255, 255, 255), font=team_font)
shift = 45
shift_common = 4
shift_fg = 6
stats_string = f"PKT{' ' * shift_common}2P{' ' * shift_fg}2P%{' ' * shift_fg}3P{' ' * shift_fg}3P%{' ' * shift_fg}1P{' ' * shift_fg}1P% ZA ZO ZS A F S P B EVAL"
image_editable.text((550, 330), stats_string, (255, 255, 255), font=font_stats_bold)
image_editable.line([(530,330), (530, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(605,330), (605, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(705,330), (705, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(830,330), (830, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(925,330), (925, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(1050,330), (1050, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(1145,330), (1145, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(1270,330), (1270, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(1330,330), (1330, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(1395,330), (1395, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(1460,330), (1460, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(1525,330), (1525, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(1590,330), (1590, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(1655, 330), (1655, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(1720, 330), (1720, 995)], fill =(0, 0, 0), width = 2)
image_editable.line([(1785, 330), (1785, 995)], fill =(0, 0, 0), width = 2)
counter = 0
for player in team.players:
number = player.number if len(player.number)==2 else f" {player.number}"
image_editable.text((100, 380 + shift * counter), number, (255, 255, 255), font=font_fullname)
image_editable.text((160, 380 + shift * counter), player.fullname, (0, 0, 0), font=font_fullname)
image_editable.text((550, 380 + shift * counter), get_object_with_stat_stats_string(player), (0, 0, 0), font=font_stats_bold)
image_editable.line([(100, 370 + shift * counter), (1850, 370 + shift * counter)], fill =(0, 0, 0), width = 2)
counter += 1
image_editable.text((160, 380 + shift * counter), "Drużynowe", (0, 0, 0), font=font_fullname)
image_editable.text((550, 380 + shift * counter), get_team_stats_string(team), (0, 0, 0), font=font_stats_bold)
image_editable.line([(100, 370 + shift * counter), (1850, 370 + shift * counter)], fill =(0, 0, 0), width = 4)
counter += 1
image_editable.text((160, 380 + shift * counter), "Suma", (0, 0, 0), font=font_fullname)
image_editable.text((550, 380 + shift * counter), get_object_with_stat_stats_string(team), (0, 0, 0), font=font_stats_bold)
image_editable.line([(100, 370 + shift * counter), (1850, 370 + shift * counter)], fill =(0, 0, 0), width = 5)
my_image.save(filename_to_save)