going-flying.com gemini git repository
a229d5fece1ee4502dc57dc2e3d893d9017ecc47 - Matthew Ernisse - 1666909144
rudimentary threading copout
diff --git a/files/thoughts-to-gemini.py b/files/thoughts-to-gemini.py index ceba0f5..50a510f 100755 --- a/files/thoughts-to-gemini.py +++ b/files/thoughts-to-gemini.py @@ -40,6 +40,9 @@ from bs4 import BeautifulSoup from feedgen.feed import FeedGenerator entry_template = '''╒═════╣▒ {{ entry.date }} ▒╟──────────┘ +{% if entry.in_reply_to %} +│ In-Reply-To: entry.in_reply_to +{% endif %} {{ entry.message }} {% if 'attachment' in entry.keys() %} @@ -377,6 +380,16 @@ class ThoughtApi(object): resp.raise_for_status() thoughts = resp.json() thoughts.sort(key=lambda k: k['id']) + + # Save the date of the In-Reply-To thought on the + # in_reply_to property insted of the ID since we + # would much rather print the datestr out. + for thought in thoughts: + if thought.get('in_reply_to'): + tId = thought['in_reply_to'] + parent = [t['date'] for t in thoughts if t['id'] == tId][0] + thought['in_reply_to'] = parent + return thoughts def _getRange(self):