decode custom messages

This commit is contained in:
Justin 2023-04-19 19:07:18 +08:00 committed by GitHub
parent 88d8ef912c
commit 665af640b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -705,15 +705,10 @@ class StockTicker():
#displays the text entered in the webpage by the user. #displays the text entered in the webpage by the user.
f = open('csv/message_settings.json', 'r') f = open('csv/message_settings.json', 'r')
all_settings = json.load(f) all_settings = json.load(f)
f.close() f.close()
colours = {'Black':(0,0,0), colours = {'Black':(0,0,0),
'White':(255,255,255), 'White':(255,255,255),
'Red':(255,0,0), 'Red':(255,0,0),
@ -739,13 +734,13 @@ class StockTicker():
font = ImageFont.load("./fonts/6x13.pil") font = ImageFont.load("./fonts/6x13.pil")
location = (0, 7) location = (0, 7)
r,g,b = colours[message['text_colour']] r,g,b = colours[message['text_colour']]
background = colours[message['background_colour']] background = colours[message['background_colour']]
decoded = message['text'].encode("ascii","ignore")
message['text'] = decoded.decode()
img = self.textImage(message['text'], font, int(r), int(g), int(b), True, w_buff = 5, background = background, location = location) img = self.textImage(message['text'], font, int(r), int(g), int(b), True, w_buff = 5, background = background, location = location)
if all_settings['title'] and ind == 0: if all_settings['title'] and ind == 0:
title_img = self.openImage('feature_titles/message.png') title_img = self.openImage('feature_titles/message.png')
imgs.append(self.stitchImage([title_img, img])) imgs.append(self.stitchImage([title_img, img]))