From 18a71faee77eb09d62c2fd15cd020b06b85405d0 Mon Sep 17 00:00:00 2001 From: Ronald Schaten Date: Sun, 31 Oct 2010 11:05:28 +0100 Subject: [PATCH] improved mail text format, included dates and times --- atomstrom.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/atomstrom.py b/atomstrom.py index 56ff5dd..d44b4c3 100755 --- a/atomstrom.py +++ b/atomstrom.py @@ -148,13 +148,17 @@ def get_entry_text(entry): def mail_daily_digest(): print 'mailing daily digest...' sender = 'atomstrom' - subject = '[atomstrom]' body = '' + count = 0 for feed, feedinfo, entry in session.query(Feed, Feedinfo, Entry).filter(Feed.id==Feedinfo.feed_id).filter(Feed.id==Entry.feed_id).filter(Feed.enabled==1).filter(Feed.daily==1).order_by(Entry.firstfetched).all(): - body = body + '=> %s - %s\n' % (feedinfo.title, entry.title) + count = count + 1 + body = body + '=> %s - %s\n' % (entry.firstfetched.strftime('%y%m%d-%H%M'), feedinfo.title) + body = body + ' %s\n' % entry.title body = body + get_entry_text(entry)[0:100] body = body + '\n' body = body + 'link: [%s]\n\n' % entry.link + today = datetime.datetime.now() + subject = '[atomstrom] %s (%s) - %d entries' % (today.strftime('%y%m%d'), today.strftime('%A'), count) send_mail(sender, subject, body) def mail_single_entry(feed, feedinfo, entry):