From 665af640b9973297a47cf24dc7754dfbd5bf36a6 Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 19 Apr 2023 19:07:18 +0800 Subject: [PATCH] decode custom messages --- stockTicker.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/stockTicker.py b/stockTicker.py index c1dd649..b9deeb0 100755 --- a/stockTicker.py +++ b/stockTicker.py @@ -705,15 +705,10 @@ class StockTicker(): #displays the text entered in the webpage by the user. - - - f = open('csv/message_settings.json', 'r') all_settings = json.load(f) f.close() - - - + colours = {'Black':(0,0,0), 'White':(255,255,255), 'Red':(255,0,0), @@ -738,14 +733,14 @@ class StockTicker(): elif message["size"] == 'Small': font = ImageFont.load("./fonts/6x13.pil") location = (0, 7) - - + r,g,b = colours[message['text_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) - - + if all_settings['title'] and ind == 0: title_img = self.openImage('feature_titles/message.png') imgs.append(self.stitchImage([title_img, img]))