improved mail text format, included dates and times

This commit is contained in:
Ronald Schaten 2010-10-31 11:05:28 +01:00
parent b3d5acc6df
commit 18a71faee7

View File

@ -148,13 +148,17 @@ def get_entry_text(entry):
def mail_daily_digest(): def mail_daily_digest():
print 'mailing daily digest...' print 'mailing daily digest...'
sender = 'atomstrom' sender = 'atomstrom'
subject = '[atomstrom]'
body = '' 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(): 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 + get_entry_text(entry)[0:100]
body = body + '\n' body = body + '\n'
body = body + 'link: [%s]\n\n' % entry.link 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) send_mail(sender, subject, body)
def mail_single_entry(feed, feedinfo, entry): def mail_single_entry(feed, feedinfo, entry):