Skip to content
This repository has been archived by the owner on May 18, 2024. It is now read-only.

Commit

Permalink
Applies Azaroths fix of players name that have accent.
Browse files Browse the repository at this point in the history
  • Loading branch information
User Name committed Feb 29, 2024
1 parent 87a31b5 commit ddf9b7c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
13 changes: 7 additions & 6 deletions src/renderer/goal.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from PIL import Image, ImageFont, ImageDraw, ImageSequence
from utils import center_text, convert_date_format
from utils import center_text, convert_date_format,strip_accents
from renderer.matrix import MatrixPixels
import debug


"""
Show the details of a goal:
- Time of the goal and which period
Expand Down Expand Up @@ -72,13 +73,13 @@ def draw_scorer(self):

self.matrix.draw_text(
(8, 20),
self.scorer["info"]["firstName"]["default"].upper(),
strip_accents(self.scorer["info"]["firstName"]["default"].upper()),
font=self.font,
fill=(255,255,255)
)
self.matrix.draw_text(
(8, 26),
self.scorer["info"]["lastName"]["default"].upper(),
strip_accents(self.scorer["info"]["lastName"]["default"].upper()),
font=self.font,
fill=(255,255,255)
)
Expand All @@ -94,7 +95,7 @@ def draw_details(self):

scorer_name_coord = self.matrix.draw_text(
(1, 8),
self.scorer["info"]["lastName"]["default"].upper(),
strip_accents(self.scorer["info"]["lastName"]["default"].upper()),
font=self.font,
fill=(255, 255, 255)
)
Expand All @@ -118,7 +119,7 @@ def draw_details(self):
for i in range(len(self.assists)):
assist_name_coord = self.matrix.draw_text(
(1, assists_y_pos),
self.assists[i]["info"]["lastName"]["default"].upper(),
strip_accents(self.assists[i]["info"]["lastName"]["default"].upper()),
font=self.font,
fill=(255, 255, 255)
)
Expand Down Expand Up @@ -173,4 +174,4 @@ def draw_hashtag(self):
self.layout.scorer_info.hashtag_dots,
pixels,
(10, 10)
)
)
6 changes: 3 additions & 3 deletions src/renderer/penalty.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PIL import Image, ImageFont, ImageDraw, ImageSequence
from utils import center_text, convert_date_format
from utils import center_text, convert_date_format, strip_accents
from renderer.matrix import MatrixPixels
import debug
from nhl_api.info import TeamInfo
Expand Down Expand Up @@ -67,7 +67,7 @@ def draw_penalty(self):

self.matrix.draw_text_layout(
self.layout.last_name,
self.player["lastName"]["default"]
strip_accents(self.player["lastName"]["default"])
)
self.matrix.draw_text_layout(
self.layout.minutes,
Expand Down Expand Up @@ -102,4 +102,4 @@ def draw_hashtag(self):
self.layout.hashtag_dots,
pixels,
(32, 10)
)
)
3 changes: 3 additions & 0 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,6 @@ def round_normal(n, decimals=0):
multiplier = 10 ** decimals
value = math.floor(n * multiplier + 0.5) / multiplier
return int(value) if decimals == 0 else value

def strip_accents(str):
return "".join(c for c in unicodedata.normalize("NFD", str) if not unicodedata.combining(c))

0 comments on commit ddf9b7c

Please sign in to comment.