From 1f65c33f60541eee5fcc38382fe12ccfaa315250 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 15 Mar 2021 18:47:14 +0000 Subject: [PATCH] Truncation --- notifications_client.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/notifications_client.py b/notifications_client.py index 7abdb036d..a65ddc18c 100644 --- a/notifications_client.py +++ b/notifications_client.py @@ -455,16 +455,20 @@ def _showLocalBox(notifyJson: {}, boxName: str, name = speakerJson['name'] else: name = '' - name = (name[:14]) if len(name) > 14 else name - while len(name) < 16: - name += ' ' + if len(name) > 16: + name = name[:16] + else: + while len(name) < 16: + name += ' ' content = speakerJson['content'] if speakerJson.get('detectedLinks'): if len(speakerJson['detectedLinks']) > 0: content = '🔗' + content - content = (content[:38]) if len(content) > 38 else content - while len(content) < 40: - content += ' ' + if len(content) > 40: + content = content[:40] + else: + while len(content) < 40: + content += ' ' print(indent + str(posStr) + ' | ' + name + ' | ' + published + ' | ' + content + ' |') ctr += 1