aboutsummaryrefslogtreecommitdiff
path: root/feedgetter.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-09-22 21:27:37 +0200
committercedricbonhomme <devnull@localhost>2010-09-22 21:27:37 +0200
commitebee8232877ae4d6a297967dad3a9fe7ed40abd6 (patch)
treec23fd640d68f131a59c9bf6537142361d9869c50 /feedgetter.py
parentRemoved useless comment. (diff)
downloadnewspipe-ebee8232877ae4d6a297967dad3a9fe7ed40abd6.tar.gz
newspipe-ebee8232877ae4d6a297967dad3a9fe7ed40abd6.tar.bz2
newspipe-ebee8232877ae4d6a297967dad3a9fe7ed40abd6.zip
Added more comments. Cleaner code.
Diffstat (limited to 'feedgetter.py')
-rwxr-xr-xfeedgetter.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/feedgetter.py b/feedgetter.py
index 6b875c64..56e61662 100755
--- a/feedgetter.py
+++ b/feedgetter.py
@@ -103,15 +103,17 @@ class FeedGetter(object):
for article in a_feed['entries']:
description = ""
try:
+ # article content
description = article.content[0].value.encode('utf-8')
except AttributeError:
try:
+ # article description
description = article.description.encode('utf-8')
except Exception, e:
description = ""
try:
- self.c.execute('insert into articles values (?,?,?,?,?,?,?)', (\
+ self.c.execute('insert into articles values (?, ?, ?, ?, ?, ?, ?)', (\
datetime(*article.updated_parsed[:6]), \
utils.clear_string(article.title.encode('utf-8')), \
article.link.encode('utf-8'), \
@@ -123,10 +125,14 @@ class FeedGetter(object):
a_feed.feed.link.encode('utf-8') + "'").fetchall()
if result[0][0] == "1":
# send the article by e-mail
- threading.Thread(None, utils.send_mail, \
- None, (utils.mail_from, utils.mail_to, \
- a_feed.feed.title.encode('utf-8'), description) \
- ).start()
+ try:
+ threading.Thread(None, utils.send_mail, \
+ None, (utils.mail_from, utils.mail_to, \
+ a_feed.feed.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
pass
bgstack15