From 6b4eff20bea59339a5f09d807e082fc2a494dd7e Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Tue, 23 Nov 2010 11:40:56 +0100 Subject: Improvement of mail notification for new articles (HTML output). --- feedgetter.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'feedgetter.py') diff --git a/feedgetter.py b/feedgetter.py index 6dc69cf8..9143de33 100755 --- a/feedgetter.py +++ b/feedgetter.py @@ -131,6 +131,7 @@ class FeedGetter(object): description = "" try: + # try. Will only success if the article is not already in the data base self.c.execute('insert into articles values (?, ?, ?, ?, ?, ?, ?)', (\ datetime(*article.updated_parsed[:6]), \ utils.clear_string(article.title.encode('utf-8')), \ @@ -142,17 +143,18 @@ class FeedGetter(object): result = self.c.execute("SELECT mail from feeds WHERE feed_site_link='" + \ a_feed.feed.link.encode('utf-8') + "'").fetchall() if result[0][0] == "1": + # if subscribed to the current feed # send the article by e-mail try: - threading.Thread(None, utils.send_mail, \ - None, (utils.mail_from, utils.mail_to, \ - a_feed.feed.title.encode('utf-8'), description) \ + threading.Thread(None, utils.send_mail, None, (utils.mail_from, utils.mail_to, \ + a_feed.feed.title.encode('utf-8'), \ + utils.clear_string(article.title.encode('utf-8')), description) \ ).start() except Exception, e: # SMTP acces denied, to many SMTP connections, etc. print e except sqlite3.IntegrityError: - # article already in the base + # article already in the data base pass except: # Missing information (updated_parsed, ...) -- cgit