aboutsummaryrefslogtreecommitdiff
path: root/source/feedgetter.py
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2013-07-24 14:45:48 +0200
committerCédric Bonhomme <kimble.mandel@gmail.com>2013-07-24 14:45:48 +0200
commit86b78a97e384475504ce6845846e547f70c47693 (patch)
treea673dca86cbe8d99abd8fa054d0c1089542958c6 /source/feedgetter.py
parentadded add_to_index function, to add an article to the Whoosh index. (diff)
downloadnewspipe-86b78a97e384475504ce6845846e547f70c47693.tar.gz
newspipe-86b78a97e384475504ce6845846e547f70c47693.tar.bz2
newspipe-86b78a97e384475504ce6845846e547f70c47693.zip
AsyncWriter is used to prevent whoosh.store.LockError error. And we only try to add new articles to the index.
Diffstat (limited to 'source/feedgetter.py')
-rwxr-xr-xsource/feedgetter.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/feedgetter.py b/source/feedgetter.py
index bd9cacc9..a9f0b01c 100755
--- a/source/feedgetter.py
+++ b/source/feedgetter.py
@@ -178,12 +178,13 @@ class FeedGetter(object):
articles.append(article)
- # add the article to the Whoosh index
- #search.add_to_index([article], feed)
+ if self.articles.get_articles(feed_id, article_id) == False:
+ # add the article to the Whoosh index
+ search.add_to_index([article], feed)
- if conf.MAIL_ENABLED and feed["mail"] and self.articles.get_articles(feed_id, article_id) == False:
- # if subscribed to the feed AND if article not already in the database
- threading.Thread(None, utils.send_mail, None, (conf.mail_from, conf.mail_to, \
+ if conf.MAIL_ENABLED and feed["mail"]:
+ # if subscribed to the feed
+ threading.Thread(None, utils.send_mail, None, (conf.mail_from, conf.mail_to, \
a_feed.feed.title, \
article_title, description)).start()
self.articles.add_articles(articles, feed_id)
bgstack15