From d2f1b59810f702d0653d210e2331cb05536292c8 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Fri, 1 Dec 2023 09:03:52 +0000 Subject: [PATCH] Also display From: lines. --- mastodonochrome | 4 ++++ text.py | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/mastodonochrome b/mastodonochrome index c68528a..6614d08 100755 --- a/mastodonochrome +++ b/mastodonochrome @@ -56,8 +56,12 @@ class Post: tm = time.strptime(date, "%Y-%m-%dT%H:%M:%S") self.datestamp = calendar.timegm(tm) + self.account = data['account'] + def text(self): yield text.SeparatorLine(self.datestamp) + yield text.FromLine('@' + self.account['acct'], + self.account['display_name']) class MainUI(Client): def run(self): diff --git a/text.py b/text.py index 3fb55f4..00f9c60 100644 --- a/text.py +++ b/text.py @@ -12,3 +12,13 @@ class SeparatorLine: # FIXME: colours suffix = "[" + date + "]--" return "-" * (width - len(suffix)) + suffix + +class FromLine: + def __init__(self, account, nameline): + self.account = account + self.nameline = nameline + + def render(self, width): + # FIXME: truncate + + return f"From: {self.nameline} ({self.account})" -- 2.30.2