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

Commit 5a2093a

Browse files
authored
Merge pull request #7 from azaroth08/dev
Dev
2 parents 0e91768 + fff4bfe commit 5a2093a

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ ephem==3.7.7.0
33
fastjsonschema>=2.14.4
44
geocoder==1.38.1
55
gpiozero==1.6.2
6-
httpx==0.20.0
76
nhl-api-py
87
noaa-sdk>=0.1.18
98
printtools==1.2

src/renderer/goal.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from PIL import Image, ImageFont, ImageDraw, ImageSequence
2-
from utils import center_text, convert_date_format
2+
from utils import center_text, convert_date_format,strip_accents
33
from renderer.matrix import MatrixPixels
44
import debug
55

6+
67
"""
78
Show the details of a goal:
89
- Time of the goal and which period
@@ -72,13 +73,13 @@ def draw_scorer(self):
7273

7374
self.matrix.draw_text(
7475
(8, 20),
75-
self.scorer["info"]["firstName"]["default"].upper(),
76+
strip_accents(self.scorer["info"]["firstName"]["default"].upper()),
7677
font=self.font,
7778
fill=(255,255,255)
7879
)
7980
self.matrix.draw_text(
8081
(8, 26),
81-
self.scorer["info"]["lastName"]["default"].upper(),
82+
strip_accents(self.scorer["info"]["lastName"]["default"].upper()),
8283
font=self.font,
8384
fill=(255,255,255)
8485
)
@@ -94,7 +95,7 @@ def draw_details(self):
9495

9596
scorer_name_coord = self.matrix.draw_text(
9697
(1, 8),
97-
self.scorer["info"]["lastName"]["default"].upper(),
98+
strip_accents(self.scorer["info"]["lastName"]["default"].upper()),
9899
font=self.font,
99100
fill=(255, 255, 255)
100101
)
@@ -118,7 +119,7 @@ def draw_details(self):
118119
for i in range(len(self.assists)):
119120
assist_name_coord = self.matrix.draw_text(
120121
(1, assists_y_pos),
121-
self.assists[i]["info"]["lastName"]["default"].upper(),
122+
strip_accents(self.assists[i]["info"]["lastName"]["default"].upper()),
122123
font=self.font,
123124
fill=(255, 255, 255)
124125
)

src/renderer/penalty.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from PIL import Image, ImageFont, ImageDraw, ImageSequence
2-
from utils import center_text, convert_date_format
2+
from utils import center_text, convert_date_format, strip_accents
33
from renderer.matrix import MatrixPixels
44
import debug
55
from nhl_api.info import TeamInfo
@@ -67,7 +67,7 @@ def draw_penalty(self):
6767

6868
self.matrix.draw_text_layout(
6969
self.layout.last_name,
70-
self.player["lastName"]["default"]
70+
strip_accents(self.player["lastName"]["default"])
7171
)
7272
self.matrix.draw_text_layout(
7373
self.layout.minutes,

src/utils.py

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import dbus
1111
import json
1212
from iso6709 import Location
13+
import unicodedata
1314

1415
uid = int(os.stat("./VERSION").st_uid)
1516
gid = int(os.stat("./VERSION").st_uid)
@@ -291,3 +292,6 @@ def round_normal(n, decimals=0):
291292
multiplier = 10 ** decimals
292293
value = math.floor(n * multiplier + 0.5) / multiplier
293294
return int(value) if decimals == 0 else value
295+
296+
def strip_accents(str):
297+
return "".join(c for c in unicodedata.normalize("NFD", str) if not unicodedata.combining(c))

0 commit comments

Comments
 (0)