summaryrefslogtreecommitdiff
path: root/user-profiles/feeds/imm-notmuch-insert.py
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2021-09-05 14:25:00 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2021-09-05 14:25:00 +0200
commitbde8d615a722b4b8b3b19367e83953c9f9928588 (patch)
tree518ebb34c2b3a020180ca80ee8f8af398e6b9b2d /user-profiles/feeds/imm-notmuch-insert.py
parentc74bb08b4338d80e1ad8f266f951556b8e9801ea (diff)
downloadnixos-bde8d615a722b4b8b3b19367e83953c9f9928588.tar
nixos-bde8d615a722b4b8b3b19367e83953c9f9928588.tar.gz
nixos-bde8d615a722b4b8b3b19367e83953c9f9928588.tar.bz2
nixos-bde8d615a722b4b8b3b19367e83953c9f9928588.tar.xz
nixos-bde8d615a722b4b8b3b19367e83953c9f9928588.zip
feeds: ...
Diffstat (limited to 'user-profiles/feeds/imm-notmuch-insert.py')
-rw-r--r--user-profiles/feeds/imm-notmuch-insert.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/user-profiles/feeds/imm-notmuch-insert.py b/user-profiles/feeds/imm-notmuch-insert.py
index ba29ce5b..b7eed292 100644
--- a/user-profiles/feeds/imm-notmuch-insert.py
+++ b/user-profiles/feeds/imm-notmuch-insert.py
@@ -25,7 +25,8 @@ def main():
25 else: 25 else:
26 msg['From'] = f"{callbackMessage['feed_definition']['title']} <imm@imm.invalid>" 26 msg['From'] = f"{callbackMessage['feed_definition']['title']} <imm@imm.invalid>"
27 msg['To'] = f"{notmuchConfig['user']['name']} <{notmuchConfig['user']['primary_email']}>" 27 msg['To'] = f"{notmuchConfig['user']['name']} <{notmuchConfig['user']['primary_email']}>"
28 msg['Subject'] = callbackMessage['feed_item']['title'] 28 if 'title' in callbackMessage['feed_item'] and callbackMessage['feed_item']['title']:
29 msg['Subject'] = callbackMessage['feed_item']['title']
29 msg['Item-Identifier'] = f"{callbackMessage['feed_item']['identifier']}" 30 msg['Item-Identifier'] = f"{callbackMessage['feed_item']['identifier']}"
30 for link in callbackMessage['feed_item']['links']: 31 for link in callbackMessage['feed_item']['links']:
31 msg.add_header('Link', link['uri']) 32 msg.add_header('Link', link['uri'])
@@ -36,8 +37,9 @@ def main():
36 date = datetime.now(tzlocal()) 37 date = datetime.now(tzlocal())
37 msg['Date'] = date.strftime('%a, %e %b %Y %T %z') 38 msg['Date'] = date.strftime('%a, %e %b %Y %T %z')
38 39
39 msg.set_content(html2text(callbackMessage['feed_item']['content'])) 40 if 'content' in callbackMessage['feed_item'] and callbackMessage['feed_item']['content']:
40 msg.add_alternative(callbackMessage['feed_item']['content'], subtype='html') 41 msg.set_content(html2text(callbackMessage['feed_item']['content']))
42 msg.add_alternative(callbackMessage['feed_item']['content'], subtype='html')
41 43
42 44
43 subprocess.run( 45 subprocess.run(